[bug] OpenAPI 3: schema items - Value MUST be an object and not an array
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 279
- PR merge metrics
- No merged PRs in 30d
Description
Related to https://github.com/google/gnostic/issues/83, https://github.com/google/gnostic/pull/84
After the PR was merged, it was rolled back in this commit:
https://github.com/google/gnostic/commit/540b24903cf26557fb13493cb9a43804da98461a#diff-38bb6d02d3442ac95d8613ef4fed0b1cb70f7bc2001d1abe71bafbede04a0dd1
```diff
- SchemaOrReference items = 30;
+ ItemsItem items = 30;
```
As the comments in the latest code say, I also agree that the wrong model is being used.
https://github.com/google/gnostic/blob/ad271d568b713ad381ad6751cd8b950eade78d98/surface/model_openapiv3.go#L386-L397
Using the `protoc-gen-openapi`:
```proto
message Foobar {
repeated string domains = 1 [
(openapi.v3.property).items.schema_or_reference = {
schema: {
format: "hostname";
}
}
];
}
```
output OpenAPI yaml:
```yaml
Foobar:
type: object
properties:
domains:
type: array
items:
- type: string
- format: hostname
```
Expected:
```yaml
Foobar:
type: object
properties:
domains:
type: array
items:
type: string
format: hostname
```
Contributor guide
Assessment
This issue has not been assessed yet.