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

MicroProfile OpenAPI 4.0 to main #1977

Merged
merged 79 commits into from
Sep 16, 2024
Merged

MicroProfile OpenAPI 4.0 to main #1977

merged 79 commits into from
Sep 16, 2024

Conversation

MikeEdgar
Copy link
Member

@MikeEdgar MikeEdgar commented Sep 5, 2024

Implementation for MicroProfile OpenAPI 4.0.

Note - once integrated, a 3.1.x branch will be created for maintenance of the 3.1 series as needed.

Azquelt and others added 30 commits May 1, 2024 17:55
This test took a noticable amount of time and more than 50% was string
contatentation building the test file.
For consistency with other model setters.
- Change schema to hold a freeform map of objects
- New getters and setters added
- Type now holds an array, but is output as a single string if it only
  contains one item
- $ref is now valid with other fields so we cannot remove other fields
  at serialization time.
- When merging objects, some array properties should be merged, but
  others (e.g. examples) shouldn't.
- Old behaviour of setType and setNullable is maintained, as we rely on it
  fairly heavily to build up schema data from multiple sources
Make a copy of a ref schema before returning it to the caller after
registering a new type to prevent the caller from corrupting the
registry entry.

This is more likely now that $ref is valid alongside other properties.

We already did a copy when a ref was retrieved from the registry, but
not when it was first registered.
- Type can now be an array, but will still be output as a string if it
  only has one element
- The schema construction for "this object, but also allow null" is
  different. Previously we could combine a $ref with nullable = true,
  but nullable has been removed and we need to instead state that null
  is allowed as a type. This requires us to use anyOf instead.
- When generating from annotations, examples is used instead of example
Existing code relying on the old semantics of these methods was changed
to use static methods on SchemaImpl which preserves the old behavior.
Make the IOContext class the creator of all IO objects.

This makes it possible for the SchemaIO class to get hold of whichever
IO objects it needs to serialize generic Constructible objects.
When adding or removing an item from a schema property that is expected
to be a collection or map, ensure that the property actually contains a
collection or map before attempting to modify it.
This means schema extensions should be maintained when a schema
references another schema but has different extensions set.

To make this work, we need to maintain the old semantics of
getExtensions and setExtensions which differentiated between returning
null and returning an empty map.
New field in 4.0, same purpose as example which was already in the list.
OAS 3.1 changes for schema model
Include the full JSON output from the scanner when a test fails, to
avoid needing to search the logs and enable debug logging.
Tests for:
- if/then/else
- allOf/anyOf/oneOf/not
- dependentSchemas
- prefixItems
- contains/maxContains/minContains
- propertyNames
- patternProperties
- contentEncoding
- contentMediaType
- contentSchema
- examples
- comment
- if/then/elseSchema
- dependentSchemas
- prefixItems
- contains/minContains/maxContains
- patternProperties
- propertyNames
- constValue
- dependentRequired
- contentEncoding/contentMediaType/contentSchema
…min-2

Support summary attribute on Info annotation
smallrye-ci and others added 15 commits July 12, 2024 12:10
* Bump io.smallrye.config:smallrye-config from 3.8.3 to 3.9.0 (#1919)

Bumps [io.smallrye.config:smallrye-config](https://github.com/smallrye/smallrye-config) from 3.8.3 to 3.9.0.
- [Release notes](https://github.com/smallrye/smallrye-config/releases)
- [Commits](smallrye/smallrye-config@3.8.3...3.9.0)

---
updated-dependencies:
- dependency-name: io.smallrye.config:smallrye-config
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump the quarkus group with 4 updates (#1921)

Bumps the quarkus group with 4 updates: io.quarkus.resteasy.reactive:resteasy-reactive-common, io.quarkus:quarkus-reactive-routes, [io.quarkus:quarkus-bom](https://github.com/quarkusio/quarkus) and io.quarkus:quarkus-maven-plugin.


Updates `io.quarkus.resteasy.reactive:resteasy-reactive-common` from 3.12.2 to 3.12.3

Updates `io.quarkus:quarkus-reactive-routes` from 3.12.2 to 3.12.3

Updates `io.quarkus:quarkus-reactive-routes` from 3.12.2 to 3.12.3

Updates `io.quarkus:quarkus-bom` from 3.12.2 to 3.12.3
- [Release notes](https://github.com/quarkusio/quarkus/releases)
- [Commits](quarkusio/quarkus@3.12.2...3.12.3)

Updates `io.quarkus:quarkus-maven-plugin` from 3.12.2 to 3.12.3

Updates `io.quarkus:quarkus-maven-plugin` from 3.12.2 to 3.12.3

---
updated-dependencies:
- dependency-name: io.quarkus.resteasy.reactive:resteasy-reactive-common
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-reactive-routes
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-reactive-routes
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: quarkus
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump org.jboss.arquillian:arquillian-bom from 1.9.0.Final to 1.9.1.Final (#1922)

Bumps [org.jboss.arquillian:arquillian-bom](https://github.com/arquillian/arquillian-core) from 1.9.0.Final to 1.9.1.Final.
- [Release notes](https://github.com/arquillian/arquillian-core/releases)
- [Commits](arquillian/arquillian-core@1.9.0.Final...1.9.1.Final)

---
updated-dependencies:
- dependency-name: org.jboss.arquillian:arquillian-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump the quarkus group with 4 updates (#1923)

* Bump the quarkus group with 4 updates

Bumps the quarkus group with 4 updates: io.quarkus.resteasy.reactive:resteasy-reactive-common, io.quarkus:quarkus-reactive-routes, [io.quarkus:quarkus-bom](https://github.com/quarkusio/quarkus) and io.quarkus:quarkus-maven-plugin.


Updates `io.quarkus.resteasy.reactive:resteasy-reactive-common` from 3.12.3 to 3.13.0

Updates `io.quarkus:quarkus-reactive-routes` from 3.12.3 to 3.13.0

Updates `io.quarkus:quarkus-reactive-routes` from 3.12.3 to 3.13.0

Updates `io.quarkus:quarkus-bom` from 3.12.3 to 3.13.0
- [Release notes](https://github.com/quarkusio/quarkus/releases)
- [Commits](quarkusio/quarkus@3.12.3...3.13.0)

Updates `io.quarkus:quarkus-maven-plugin` from 3.12.3 to 3.13.0

Updates `io.quarkus:quarkus-maven-plugin` from 3.12.3 to 3.13.0

---
updated-dependencies:
- dependency-name: io.quarkus.resteasy.reactive:resteasy-reactive-common
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-reactive-routes
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-reactive-routes
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: quarkus
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update to `PropertiesConfigSource` in `QuarkusAnnotationScanIT`

Signed-off-by: Michael Edgar <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Michael Edgar <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Edgar <[email protected]>

* Bump io.smallrye:jandex from 3.2.0 to 3.2.1 (#1925)

Bumps [io.smallrye:jandex](https://github.com/smallrye/jandex) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/smallrye/jandex/releases)
- [Commits](smallrye/jandex@3.2.0...3.2.1)

---
updated-dependencies:
- dependency-name: io.smallrye:jandex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump org.eclipse.parsson:parsson from 1.1.6 to 1.1.7 (#1926)

Bumps [org.eclipse.parsson:parsson](https://github.com/eclipse-ee4j/parsson) from 1.1.6 to 1.1.7.
- [Release notes](https://github.com/eclipse-ee4j/parsson/releases)
- [Commits](eclipse-ee4j/parsson@1.1.6...1.1.7)

---
updated-dependencies:
- dependency-name: org.eclipse.parsson:parsson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Ignore JavaBean method prefixes when method name matches field name (#1928)

Signed-off-by: Michael Edgar <[email protected]>

* Represent `java.net.URL` as type string (#1929)

Signed-off-by: Michael Edgar <[email protected]>

* Decrease level of SROAP01001 from INFO to DEBUG (#1930)

Signed-off-by: Michael Edgar <[email protected]>

* Adjust test expectation for OpenAPI 3.1.0

Signed-off-by: Michael Edgar <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Michael Edgar <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Michael Edgar <[email protected]>
This test is supposed to ensure that the openapi version is read from
the expected locations.

It was broken because all sources were setting the same version.
Support for OpenAPI v3.0 is implemented as a transformation on input and
output. The changes between the two formats are minimal and mostly in
the Schema object.

When reading or writing the OpenAPI version is read from the document
or model respectively.

When generating a document for an application, config is read and if a
verison is configured the OpenAPI version in the model will be updated
before it is output.
Test reading and writing of OpenAPI v3.0 documents and application of
config.
Add additional transformations when reading and writing 3.0 schemas.

These convert between idioms used in v3.0 and v3.1 of OpenAPI and will
keep our 3.0 output similar to what was produced by previous versions.

Also fix deserialization of boolean schemas.
Add schema tests which test reading and writing OpenAPI 3.0 and
translating between 3.1 and 3.0.
Support generation of OpenAPI v3.0
Signed-off-by: Michael Edgar <[email protected]>
@MikeEdgar MikeEdgar added this to the 4.0.0 milestone Sep 5, 2024
github-actions[bot]

This comment was marked as outdated.

Copy link

sonarcloud bot commented Sep 5, 2024

@MikeEdgar MikeEdgar dismissed github-actions[bot]’s stale review September 5, 2024 10:30

Not relevant for non-release PR

@MikeEdgar MikeEdgar marked this pull request as ready for review September 16, 2024 10:52
@MikeEdgar MikeEdgar requested a review from a team as a code owner September 16, 2024 10:52
@MikeEdgar
Copy link
Member Author

@phillip-kruger I think we can go ahead and merge this to main for MP OAS 4.0. We'll keep maintaining a 3.1.x branch for the foreseeable future until there is enough downstream adoption of 4.0.

@phillip-kruger
Copy link
Member

Yes go for it ! Sorry, I hope I was not the hold up. This fell through the cracks

@MikeEdgar
Copy link
Member Author

Yes go for it ! Sorry, I hope I was not the hold up. This fell through the cracks

Thank you. You were not the hold up - I had it in draft for a while :-)

@MikeEdgar MikeEdgar merged commit 710ef7f into main Sep 16, 2024
7 checks passed
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.

5 participants