// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

syntax = "proto3";

package conformance;

option java_package = "com.google.protobuf.conformance";
option objc_class_prefix = "Conformance";

// This defines the conformance testing protocol.  This protocol exists between
// the conformance test suite itself and the code being tested.  For each test,
// the suite will send a ConformanceRequest message and expect a
// ConformanceResponse message.
//
// You can either run the tests in two different ways:
//
//   1. in-process (using the interface in conformance_test.h).
//
//   2. as a sub-process communicating over a pipe.  Information about how to
//      do this is in conformance_test_runner.cc.
//
// Pros/cons of the two approaches:
//
//   - running as a sub-process is much simpler for languages other than C/C++.
//
//   - running as a sub-process may be more tricky in unusual environments like
//     iOS apps, where fork/stdin/stdout are not available.

enum WireFormat {
  UNSPECIFIED = 0;
  PROTOBUF = 1;
  JSON = 2;
  JSPB = 3;  // Only used inside Google. Opensource testees just skip it.
  TEXT_FORMAT = 4;
}

enum TestCategory {
  UNSPECIFIED_TEST = 0;
  BINARY_TEST = 1;  // Test binary wire format.
  JSON_TEST = 2;    // Test json wire format.
  // Similar to JSON_TEST. However, during parsing json, testee should ignore
  // unknown fields. This feature is optional. Each implementation can decide
  // whether to support it.  See
  // https://developers.google.com/protocol-buffers/docs/proto3#json_options
  // for more detail.
  JSON_IGNORE_UNKNOWN_PARSING_TEST = 3;
  // Test jspb wire format. Only used inside Google. Opensource testees just
  // skip it.
  JSPB_TEST = 4;
  // Test text format. For cpp, java and python, testees can already deal with
  // this type. Testees of other languages can simply skip it.
  TEXT_FORMAT_TEST = 5;
}

// The conformance runner will request a list of failures as the first request.
// This will be known by message_type == "conformance.FailureSet", a conformance
// test should return a serialized FailureSet in protobuf_payload.
message FailureSet {
  repeated string failure = 1;
}

// Represents a single test case's input.  The testee should:
//
//   1. parse this proto (which should always succeed)
//   2. parse the protobuf or JSON payload in "payload" (which may fail)
//   3. if the parse succeeded, serialize the message in the requested format.
message ConformanceRequest {
  // The payload (whether protobuf of JSON) is always for a
  // protobuf_test_messages.proto3.TestAllTypes proto (as defined in
  // src/google/protobuf/proto3_test_messages.proto).
  oneof payload {
    bytes protobuf_payload = 1;
    string json_payload = 2;
    // Only used inside Google.  Opensource testees just skip it.
    string jspb_payload = 7;
    string text_payload = 8;
  }

  // Which format should the testee serialize its message to?
  WireFormat requested_output_format = 3;

  // The full name for the test message to use; for the moment, either:
  // protobuf_test_messages.proto3.TestAllTypesProto3 or
  // protobuf_test_messages.google.protobuf.TestAllTypesProto2.
  string message_type = 4;

  // Each test is given a specific test category. Some category may need
  // specific support in testee programs. Refer to the definition of
  // TestCategory for more information.
  TestCategory test_category = 5;

  // Specify details for how to encode jspb.
  JspbEncodingConfig jspb_encoding_options = 6;

  // This can be used in json and text format. If true, testee should print
  // unknown fields instead of ignore. This feature is optional.
  bool print_unknown_fields = 9;
}

// Represents a single test case's output.
message ConformanceResponse {
  oneof result {
    // This string should be set to indicate parsing failed.  The string can
    // provide more information about the parse error if it is available.
    //
    // Setting this string does not necessarily mean the testee failed the
    // test.  Some of the test cases are intentionally invalid input.
    string parse_error = 1;

    // If the input was successfully parsed but errors occurred when
    // serializing it to the requested output format, set the error message in
    // this field.
    string serialize_error = 6;

    // This should be set if the test program timed out.  The string should
    // provide more information about what the child process was doing when it
    // was killed.
    string timeout_error = 9;

    // This should be set if some other error occurred.  This will always
    // indicate that the test failed.  The string can provide more information
    // about the failure.
    string runtime_error = 2;

    // If the input was successfully parsed and the requested output was
    // protobuf, serialize it to protobuf and set it in this field.
    bytes protobuf_payload = 3;

    // If the input was successfully parsed and the requested output was JSON,
    // serialize to JSON and set it in this field.
    string json_payload = 4;

    // For when the testee skipped the test, likely because a certain feature
    // wasn't supported, like JSON input/output.
    string skipped = 5;

    // If the input was successfully parsed and the requested output was JSPB,
    // serialize to JSPB and set it in this field. JSPB is only used inside
    // Google. Opensource testees can just skip it.
    string jspb_payload = 7;

    // If the input was successfully parsed and the requested output was
    // TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field.
    string text_payload = 8;
  }
}

// Encoding options for jspb format.
message JspbEncodingConfig {
  // Encode the value field of Any as jspb array if true, otherwise binary.
  bool use_jspb_array_any_format = 1;
}
