-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format option of array type is located in the wrong place #3403
Comments
Just to prove that the current location is wrong here is a sample yaml to copy-paste to https://editor.swagger.io/ When openapi: 3.0.3
info:
title: Swagger Petstore - OpenAPI 3.0
version: 1.0.11
paths:
/user:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
responses:
default:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/User'
components:
schemas:
User:
type: object
properties:
tags:
type: array
items:
type: string
format: uuid |
Hi @far4599! Thanks for reporting the issue and locating the source. Would you be willing to send a PR fixing it along with a test case? Happy to help with any questions. |
Sure. I'll do this. |
Hi @adambabik! RP is ready. Review, please. |
🐛 Bug Report
This bug relates to
protoc-gen-openapiv2
.It looks like
format
option with array type is placed in the wrong place when compiled to json. Nowformat
is placed at the root of the property object. But according to the spec:items
option describes the type of items in the array. Soformat
shall be a part ofitems
object as the other item type descriptors.The problem is located here: https://github.com/grpc-ecosystem/grpc-gateway/blob/main/protoc-gen-openapiv2/internal/genopenapi/template.go#L2751C5-L2751C5
where all the type properties (except
format
) are set to theItems
object.To Reproduce
complied json schema:
Expected behavior
The text was updated successfully, but these errors were encountered: