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

fix(cts): allow different ordering of oneOf schema #1654

Closed
wants to merge 1 commit into from

Conversation

shortcuts
Copy link
Member

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/DI-1379

Changes included:

This PR makes the CTS code generation work for complex oneOf schemas like in #1647.

Today we only guess the matching oneOf by counting the number of matching elements, which is correct but enforce a specific order. The proposed solution is not more correct, but a bit looser as it doesn't enforce the element to be first in the oneOf matching list.

🧪 Test

This PR shouldn't impact the current CTS generation.

@shortcuts shortcuts requested a review from a team as a code owner June 22, 2023 08:57
@shortcuts shortcuts self-assigned this Jun 22, 2023
@shortcuts shortcuts requested review from Fluf22 and mehmetaligok June 22, 2023 08:57
@netlify
Copy link

netlify bot commented Jun 22, 2023

Deploy Preview for api-clients-automation ready!

Name Link
🔨 Latest commit 2e8a41e
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/64940d07dca8d10008f2efd6
😎 Deploy Preview https://deploy-preview-1654--api-clients-automation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@algolia-bot
Copy link
Collaborator

algolia-bot commented Jun 22, 2023

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

@shortcuts
Copy link
Member Author

shoot, not everywhere

@shortcuts
Copy link
Member Author

this can't work with the current way of generating the CTS, will try further with an other solution

@shortcuts shortcuts closed this Jun 22, 2023
@shortcuts shortcuts deleted the fix/generator-cts-oneof branch June 22, 2023 12:37
@shortcuts shortcuts restored the fix/generator-cts-oneof branch June 22, 2023 13:03
@kai687
Copy link
Contributor

kai687 commented Jun 22, 2023

@shortcuts let me know if this is too much trouble. We can just use a single request body and iterate at a later time.

@shortcuts
Copy link
Member Author

@shortcuts let me know if this is too much trouble. We can just use a single request body and iterate at a later time.

it's fine we should be able to just remove the test for now, we know that the payload is corretly parsed anyway as we test other payload shape

@shortcuts shortcuts deleted the fix/generator-cts-oneof branch July 11, 2023 14:11
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