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

[4.9] Default openapi version in Context to 3.0.0 #1563

Merged
merged 5 commits into from
Apr 18, 2024

Conversation

DerManoMann
Copy link
Collaborator

@DerManoMann DerManoMann commented Mar 25, 2024

Fixes #1562

This PR also (re-)enables the deprecation trigger in Context:detect(). The problems the changes around the version check illustrate how fragile the whole concept of Context is and not caring about where/what is in the context is asking for trouble.

@gnutix
Copy link

gnutix commented Mar 25, 2024

I'm not sure I understand how the bug happens and why this PR would fix it. From my POV, it seems like you had some logic inlined in a method, and now you've reverted that inlinment. But I don't see a "change" in the logic / flow of code itself. Could you explain it to me? I'm puzzled.

Also (re-)enables the deprecated trigger in `Context::detect()`
@DerManoMann
Copy link
Collaborator Author

I'm not sure I understand how the bug happens and why this PR would fix it. From my POV, it seems like you had some logic inlined in a method, and now you've reverted that inlinment. But I don't see a "change" in the logic / flow of code itself. Could you explain it to me? I'm puzzled.

The difference with using isVersion is that there is a check if version is checked at all. Comparing context->version directly does not have that check and doesn't care if the version is set at all.

I've removed the check and context will now default to 3.0.0 if no version is set. This is still not ideal IMO, but a safer version of how it was before.

Since the syncing of the 'final' value of the version string happens in Generator::generate, when creating Context instances outside the default flow it might be good to set the expected version on the context (just like any other context property) provided the target version is known/available at the time.

@DerManoMann DerManoMann changed the title Revert bad version checks [4.9] Default openapi version in Context to 3.0.0 Apr 17, 2024
@DerManoMann DerManoMann merged commit b46a36d into zircote:master Apr 18, 2024
21 checks passed
@DerManoMann DerManoMann deleted the revert-bad-version-check branch April 18, 2024 22:32
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.

[4.8.7] Version is only available reliably for validation and serialization
2 participants