Skip to content

Expose operation on the runtime_request.#216

Merged
ahx merged 1 commit intoahx:mainfrom
MrBananaLord:expose-operation
Jan 15, 2024
Merged

Expose operation on the runtime_request.#216
ahx merged 1 commit intoahx:mainfrom
MrBananaLord:expose-operation

Conversation

@MrBananaLord
Copy link
Copy Markdown
Contributor

I'd like to be able to programmatically access the OAS definition details. Exposing the operation would make it possible by doing: request(env).operation[key]

What do you think about that? :)

@MrBananaLord MrBananaLord requested a review from ahx as a code owner January 15, 2024 10:27
@ahx
Copy link
Copy Markdown
Owner

ahx commented Jan 15, 2024

Hi! After reading about OpenAPI 4 (which thinks more in "requests" than "operation"), I have made some Openapi 3 specific jargon less visible from the API in 1.0 to get a good chance of being backwards compatible when "Moonwalk" is coming. However, at this point this seems pretty premature. So I am open for the idea if you need it, but if possible I would like to use a more abstract API instead.

What field do you want to access specifically? Did you see RuntimeRequest#path_definition?

@MrBananaLord
Copy link
Copy Markdown
Contributor Author

We have a custom property x-foo. So maybe we could make all custom properties exposed instead of the whole operation 🤔 https://swagger.io/docs/specification/openapi-extensions/

@ahx
Copy link
Copy Markdown
Owner

ahx commented Jan 15, 2024

We have a custom property x-foo. So maybe we could make all custom properties exposed instead of the whole operation 🤔 https://swagger.io/docs/specification/openapi-extensions/

That sounds like a pretty common use case.
I have two ideas about this:

  1. expose .operation as you did here
  2. call it something "more abstract" like .definition or the like.

…I think i prefer 1., because it is less confusing if you already know OpenAPI, which you probably do if you are using this gem :)

@MrBananaLord
Copy link
Copy Markdown
Contributor Author

I'd go with the .operation :D

@ahx ahx merged commit 10fc8d9 into ahx:main Jan 15, 2024
@MrBananaLord MrBananaLord deleted the expose-operation branch January 15, 2024 13:24
@ahx ahx mentioned this pull request Jan 22, 2024
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