-
Notifications
You must be signed in to change notification settings - Fork 422
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 OpenAPI Callback circe encoder #2098
Conversation
Thanks! But maybe the model is simply wrong? I mean the Also, if you'd need a better api to add callbacks, let's simply add this to |
Hi @adamw. I think you're right and the model is wrong. According to the Open API spec the
Where a An operation I can spend more time getting tapir's Open API model to encode the correct schema for callbacks, but I have some other priorities this week that I need to work on first. Can you clarify what you mean with this statement:
Are you proposing extending |
I see now how the encoder in this PR is handling extensions and it's indeed incorrect. I don't think extensions belong at this level since it's supposed to represent a key/value mapping of callback names to callbacks. Extensions might be handled in the |
No, I think adding to |
Got it. Works for me! |
I think this solution is a little convoluted. I may be missing something with the design considerations in the The current implementation demonstrates adding callbacks to operations and components, as well as referencing a reusable callback. How the test's expected yaml looks like generated with redoc: |
@seglo we need to support multiple paths in callbacks, so I added the map back, changing the encoder. I also changed the test to use quicklens, I think it's more readable now :) |
That looks much better, thanks. I had trouble adding quicklens to the project, but I see you were able to resolve that! |
fixes #2095
Omits
pathItems
from being encoded into output JSON, similar toEncoder[Responses]
andEncoder[PathItem]
. Produces valid OpenAPI spec for callbacks.The test is a big hack to add a callback, because it's not currently supported in the
Endpoint
DSL. I can drop that if you like.