Andrew Wilson 1136872cd5
[feat] [protobuf] Improve protobuf generator with switch useSimplifiedEnumNames (#21052)
* improving with simple enum names

* adding test case

* fixing docs

* fixing param name

* fix docs
2025-04-16 16:32:36 +08:00

170 lines
2.0 KiB
Protocol Buffer

/*
OpenAPI Petstore
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator: https://openapi-generator.tech
*/
syntax = "proto3";
package petstore;
import public "google/protobuf/struct.proto";
message ApiResponse {
int32 code = 1;
string type = 2;
string message = 3;
}
message Cat {
bool hunts = 1;
int32 age = 2;
}
message Category {
int64 id = 1;
string name = 2;
}
message Dog {
bool bark = 1;
enum Breed {
UNSPECIFIED = 0;
DINGO = 1;
HUSKY = 2;
RETRIEVER = 3;
SHEPHERD = 4;
}
Breed breed = 2;
}
message Error {
// Error code.
int32 code = 1;
// Detailed error message.
string message = 2;
}
message Order {
int64 id = 1;
int64 pet_id = 2 [json_name="petId"];
int32 quantity = 3;
string ship_date = 4 [json_name="shipDate"];
// Order Status
enum Status {
UNSPECIFIED = 0;
PLACED = 1;
APPROVED = 2;
DELIVERED = 3;
}
Status status = 5;
bool complete = 6;
google.protobuf.Struct meta = 7;
}
message OtherTest {
repeated string set_test = 1;
}
message Pet {
int64 id = 1;
Category category = 2;
string name = 3;
repeated string photo_urls = 4 [json_name="photoUrls"];
repeated Tag tags = 5;
// pet status in the store
enum Status {
UNSPECIFIED = 0;
AVAILABLE = 1;
PENDING = 2;
SOLD = 3;
}
Status status = 6;
}
message PetsGetRequest {
oneof pets_get_request {
Cat cat = 1;
Dog dog = 2;
}
}
message PetsPostRequest {
Cat cat = 1;
Dog dog = 2;
}
message Tag {
int64 id = 1;
string name = 2;
}
message User {
int64 id = 1;
string username = 2;
string first_name = 3 [json_name="firstName"];
string last_name = 4 [json_name="lastName"];
string email = 5;
string password = 6;
string phone = 7;
// User Status
int32 user_status = 8 [json_name="userStatus"];
}