-
Notifications
You must be signed in to change notification settings - Fork 429
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
Fix hidden schema visible in OpenAPI generated yml #3820
Conversation
@@ -44,6 +45,23 @@ private[openapi] class EndpointToOpenAPIPaths( | |||
(e.showPathTemplate(showQueryParam = None, includeAuth = false, showNoPathAs = "/", showPathsAs = None), pathItem) | |||
} | |||
|
|||
private def filterOutHiddenInputs(inputs: Vector[EndpointInput.Basic[_]]) = inputs | |||
.filter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- maybe we can combine it in a .collect?
- are we doing filtering on hidden someplace else in this module as well? I think it used to work for e.g. queries, so maybe it's not needed now?
variants.filterNot(_.codec.schema.hidden), | ||
mapping | ||
) | ||
case a: EndpointInput.Atom[_] if !a.codec.schema.hidden => a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment, that a Basic input is either a OneOfBody, or an Atom, so we're not filtering out anything more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collect uses PartialFunction, which is prone to overlooking cases. Maybe filter with a total function is safer so that we explicitly see which cases are rejected, guarded by the compiler?
closes #3617