Skip to content

Conversation

@jgreffe
Copy link
Contributor

@jgreffe jgreffe commented Nov 12, 2025

References to other Issues or PRs

Fixes #6080

Have you read the Contributing Guidelines?

Brief description of what is fixed or changed

Introduce a new option omit_array_item_type_when_ref_sibling which allows to omit a type: object if a $ref already exists.
This fixes strict no-$ref-siblings rule violations.
But default this option is false to keep previous behavior.

Other comments

}
}

func TestArrayMessageItemsTypeOmitWhenRefSibling(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost the same test as TestArrayMessageItemsType, but we check we don't have results like these.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! Could you please add a section to our docs for this new option? https://github.com/grpc-ecosystem/grpc-gateway/blob/main/docs/docs/mapping/customizing_openapi_output.md is usually used for options.

Also, since this is a new option, we need to add support for it to our Bazel definitions. Please see existing patterns for options in https://github.com/grpc-ecosystem/grpc-gateway/blob/main/protoc-gen-openapiv2/defs.bzl and add this option. Thanks!

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, thank you!

@johanbrandhorst johanbrandhorst enabled auto-merge (squash) November 13, 2025 16:21
@johanbrandhorst
Copy link
Collaborator

Looks like a minor formatting issue in the bazel file, I would ignore the fuzz error

Signed-off-by: Julien Greffe <[email protected]>
auto-merge was automatically disabled November 14, 2025 09:25

Head branch was pushed to by a user without write access

@johanbrandhorst johanbrandhorst enabled auto-merge (squash) November 14, 2025 18:01
@johanbrandhorst johanbrandhorst merged commit 0e74a90 into grpc-ecosystem:main Nov 14, 2025
14 checks passed
@johanbrandhorst
Copy link
Collaborator

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

protoc-gen-openapiv2 violation of strict rule no-$ref-siblings

2 participants