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

Fixes issue 1975: bug in const processing, const values of all types now processable #1996

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

spacether
Copy link
Contributor

@spacether spacether commented Nov 1, 2023

Changes const type from String to Object
Per json schema docs, const stores one values of any json schema type

Verification:

  • java tests added verifying ingestion of json null/string/number/object/array/boolean

If merged, this will close out these issues:

@spacether spacether marked this pull request as draft November 1, 2023 19:42
@spacether spacether changed the title Changes const type from string to Object Changes const type from String to Object Nov 1, 2023
@spacether spacether changed the title Changes const type from String to Object Fixes bug in const processing, changes const type from String to Object Nov 1, 2023
@spacether spacether changed the title Fixes bug in const processing, changes const type from String to Object Fixes bug in const processing, const values of all types now processable Nov 1, 2023
@spacether spacether changed the title Fixes bug in const processing, const values of all types now processable Fixes issue 1975: bug in const processing, const values of all types now processable Nov 1, 2023
@spacether spacether marked this pull request as ready for review November 1, 2023 22:06
@spacether
Copy link
Contributor Author

spacether commented Nov 1, 2023

@frantuma @gracekarina thank you for your work on swagger-parser.
When you have some time can you review this PR?
How do I get CI tests to run?
The test that I added passes locally.
Getting this merged in and released would help me turn on 34 json schema tests in openapi-json-schema-generator
Thank you!

ObjectNode objNode = mapper.createObjectNode();
objNode.put("foo", "bar");
objNode.put("baz", "bax");
assertEquals(openAPI.getComponents().getSchemas().get("ConstWithObject").getConst(), objNode);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a LinkedHashMap instead?

ObjectNode arrayItem = mapper.createObjectNode();
arrayItem.put("foo", "bar");
arrayNode.add(arrayItem);
assertEquals(openAPI.getComponents().getSchemas().get("ConstWithArray").getConst(), arrayNode);
Copy link
Contributor Author

@spacether spacether Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a List or ArrayList instead?

@frantuma frantuma force-pushed the feat_fixes_const_type branch from 78849f1 to 1b1fa85 Compare November 7, 2023 10:24
@frantuma frantuma merged commit dfda9d9 into swagger-api:master Nov 7, 2023
5 checks passed
@frantuma
Copy link
Member

frantuma commented Nov 7, 2023

Thanks!

@spacether
Copy link
Contributor Author

Thanks you for the review and merge!

@spacether spacether deleted the feat_fixes_const_type branch November 7, 2023 16:34
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.

2 participants