-
Notifications
You must be signed in to change notification settings - Fork 266
Open
Description
After the PR was merged, it was rolled back in this commit:
540b249#diff-38bb6d02d3442ac95d8613ef4fed0b1cb70f7bc2001d1abe71bafbede04a0dd1
- SchemaOrReference items = 30;
+ ItemsItem items = 30;
As the comments in the latest code say, I also agree that the wrong model is being used.
gnostic/surface/model_openapiv3.go
Lines 386 to 397 in ad271d5
case "array": | |
// I do believe there is a bug inside of OpenAPIv3.proto. I think the type of "schema.Items.SchemaOrReference" | |
// shouldn't be an array of pointers but rather a single pointer. | |
// According to: https://swagger.io/specification/#schemaObject | |
// The 'items' "Value MUST be an object and not an array" and "Inline or referenced schema MUST be of a Schema Object" | |
for _, schemaOrRef := range schema.Items.SchemaOrReference { | |
arrayFieldInfo := b.buildFromSchemaOrReference(name, schemaOrRef) | |
if arrayFieldInfo != nil { | |
fInfo.fieldKind, fInfo.fieldType, fInfo.fieldFormat, fInfo.enumValues = FieldKind_ARRAY, arrayFieldInfo.fieldType, arrayFieldInfo.fieldFormat, arrayFieldInfo.enumValues | |
return fInfo | |
} | |
} |
Using the protoc-gen-openapi
:
message Foobar {
repeated string domains = 1 [
(openapi.v3.property).items.schema_or_reference = {
schema: {
format: "hostname";
}
}
];
}
output OpenAPI yaml:
Foobar:
type: object
properties:
domains:
type: array
items:
- type: string
- format: hostname
Expected:
Foobar:
type: object
properties:
domains:
type: array
items:
type: string
format: hostname
Metadata
Metadata
Assignees
Labels
No labels