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

Why require OpenAPI processing for a non-JAX-RS/Spring deployment? #413

Closed
pferraro opened this issue Feb 26, 2020 · 7 comments · Fixed by #526
Closed

Why require OpenAPI processing for a non-JAX-RS/Spring deployment? #413

pferraro opened this issue Feb 26, 2020 · 7 comments · Fixed by #526

Comments

@pferraro
Copy link

pferraro commented Feb 26, 2020

The following TCK tests:

  • ModelConstructionTest
  • OASFactoryErrorTest
  • StaticDocumentTest

... use web application archives that do not contain any JAX-RS nor Spring applications. Why should an implementation of MicroProfile OpenAPI be required to perform any OpenAPI processing for such a deployment?

@EricWittmann
Copy link
Contributor

I think because it is possible to disable annotation scanning. Annotation scanning is useful primarily when doing code-first API development. However, the spec also covers alternative use-cases. The static document processing support (for example) covers the Design-First approach to API development. In that case you would design an API (for example using https://studio.apicur.io ) and then implement it using JAX-RS, but configure MP-OpenAPI to include the API design in the deployment and disable annotation scanning.

I suppose the TCK could be made more realistic by actually including some JAX-RS resources in the deployments but configure them to disable scanning.

Those tests are designed to specifically test the non-annotation scanning functionality of the specification.

@kenfinnigan
Copy link

From the perspective that MicroProfile will always have JAX-RS present, it's probably more accurate for the tests to include JAX-RS Applications but disable scanning.

@jmini
Copy link
Contributor

jmini commented Jun 10, 2020

There is an interesting approach done by the SmallRye OpenAPI project:

Since version 2.0.0, they started to introduce support Microprofile OpenAPI on top of Spring. So in this case you do not have JaxRS.

@pferraro
Copy link
Author

Since version 2.0.0, they started to introduce support Microprofile OpenAPI on top of Spring. So in this case you do not have JaxRS.

AFAICT, there is no TCK coverage for Spring applications. The problematic tests mentioned in my first comment are neither JAX-RS nor Spring applications. Thus, the issue still remains, i.e. in order to pass the TCK, a container must include OpenAPI processing for all WARs, not just JAX-RS (or Spring) applications.

@MikeEdgar
Copy link
Member

@pferraro, we discussed this topic in today's OpenAPI call. Do you still view this as an issue in the TCK? Did it cause a problem or is it more of an observation/question?

@pferraro
Copy link
Author

pferraro commented Mar 8, 2022

@MikeEdgar The side effect of these TCK tests (i.e. those that use an "empty" test application without any JAX-RS endpoints) is that a container must expose an OpenAPI endpoint for every web application, even those that use neither JAX-RS nor Spring, otherwise the container will not pass the MicroProfile OpenAPI TCK. This does not make sense to me.

@pferraro pferraro changed the title Why require OpenAPI processing for a non-JAX-RS deployment? Why require OpenAPI processing for a non-JAX-RS/Spring deployment? Mar 9, 2022
Azquelt pushed a commit to Azquelt/microprofile-open-api that referenced this issue Mar 17, 2022
Allow scanners to pass in their own ClassLoader
@MikeEdgar
Copy link
Member

MikeEdgar commented Mar 26, 2022

We briefly discussed this issue in a recent team call and the suggestion is to update the spec and TCK to indicate that an OpenAPI deployment (i.e. hosting of endpoint /openapi) is only required when one or more of the following is true for a deployment/application:

  • An OASModelReader has been configured with mp.openapi.model.reader
  • An OASFilter has been configured with mp.openapi.filter
  • One of the allowed static files is present, i.e. META-INF/openapi.(json|yaml)
  • The application uses JAX-RS

If there are no disagreements with the approach, this can be marked for inclusion in the 3.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants