Skip to content
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

Ignore specific markers in openapi generation from protos #576

Merged
merged 10 commits into from
Aug 8, 2024

Conversation

jjamroga
Copy link
Contributor

@jjamroga jjamroga commented Aug 7, 2024

Description

This allows for the user to define a list of kube markers to be ignored. Useful when referencing a .proto dependency which contains kube markers that aren't supported, and will never be supported.

Use case: I'm defining a proto that relies on some upstream dependency that also contains their own kube markers. These kube markers exist only for documentation, and do not affect the open api schema. Rather than implement noop markers to add to a marker registry, I would like to simply ignore them.

This adds:

  • An additional argument to the protoc-gen-openapi executor

This changes:

  • The way that protoc-gen-openapi arguments are structured (for readability's sake)

Related Issue: solo-io/protoc-gen-openapi#27

Testing Done

See parent PR

@solo-changelog-bot
Copy link

Issues linked to changelog:
https://github.com/solo-io/gloo-mesh-enterprise/issues/18119

Comment on lines +111 to +115
baseArgument := "--openapi_out=yaml=true,single_file=false,include_description=true,multiline_description=true,proto_oneof=true,int_native=true"
baseArgument = fmt.Sprintf("%s,enum_as_int_or_string=%v", baseArgument, o.EnumAsIntOrString)
baseArgument = fmt.Sprintf("%s,additional_empty_schema=%v", baseArgument, strings.Join(o.MessagesWithEmptySchema, "+"))
baseArgument = fmt.Sprintf("%s,disable_kube_markers=%v", baseArgument, o.DisableKubeMarkers)
baseArgument = fmt.Sprintf("%s,ignored_kube_marker_substrings=%v", baseArgument, strings.Join(o.IgnoredKubeMarkerSubstrings, "+"))
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to make this more readable, I'd group these options into a slice and use strings.Join().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah honestly I should have done that. I think this is better than what we have, so if we revisit this and add another argument we could improve this again.

@soloio-bulldozer soloio-bulldozer bot merged commit 17c9f0d into main Aug 8, 2024
3 checks passed
@soloio-bulldozer soloio-bulldozer bot deleted the ignore_specific_markers branch August 8, 2024 15:27
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.

3 participants