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

OpenAPI JAX-RS Incomplete subresource support /FISH-5808 #3042

Open
vassterg opened this issue Aug 14, 2018 · 8 comments
Open

OpenAPI JAX-RS Incomplete subresource support /FISH-5808 #3042

vassterg opened this issue Aug 14, 2018 · 8 comments
Assignees
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Enhancement Label issue as an enhancement request

Comments

@vassterg
Copy link

vassterg commented Aug 14, 2018

Description


Incomplete support of openapi when subresource is present.
I have two classes Foo and Bar such that Foo is a jaxrs resource and Bar is a subresource.
When deployed, the openapi link is incomplete.

Expected Outcome

I would expect in the openapi link, the Bar sub resource GET endpoint to show up in the openapi and the Bar sub resource to be included as a schema.

Current Outcome

openapi: 3.0.0
info:
  title: Deployed Resources
  version: 1.0.0
servers:
- url: http://localhost:8080/openapi-test
  description: Default Server.
paths:
  /resources/foo:
    get:
      operationId: getMethod
      responses:
        default:
          description: Default Response.
          content:
            '*/*':
              schema:
                type: string
components: {}

No endpoint and schema for subresource bar.

Steps to reproduce (Only for bug reports)

Create a simple javaee 8 maven JAX-RS project.
Example pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.insurit</groupId>
    <artifactId>openapi-test</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>openapi-test</finalName>
    </build>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </properties>
    <name>openapi-test</name>
</project>

Add the following three classes:

@ApplicationPath("resources")
public class JAXRSConfiguration extends Application {

}
@Path("foo")
public class Foo {

    @Context
    private ResourceContext rc;

    @GET
    public String getMethod() {
        return "get foo";
    }
    
    @Path("bar")
    public Bar sub() {
        return rc.getResource(Bar.class);
    }
}
public class Bar {

    @GET
    public Response barMethod() {
        return Response.ok().entity("bar").build();
    }
}

Build and deploy project. Then access http://localhost:8080/openapi

Samples

Context (Optional)

Environment

  • Payara Version: 5.182
  • Edition: Full
  • JDK Version: 1.8.0_181; Java HotSpot(TM) 64-Bit Server VM 25.181-b13
  • Operating System: Linux / Ubuntu 18.04
  • Database:
@vassterg
Copy link
Author

Attached is a sample pmaven project and the final artifact for deployment

openapi-jaxrs-subresource-incomplete.zip
openapi-incomplete.zip

@vassterg vassterg reopened this Aug 27, 2018
@MattGill98
Copy link
Contributor

Hi @vassterg,

The current OpenAPI implementation doesn't support subresources. I've made an enhancement request PAYARA-3086 to add this functionality.

Kind regards,

Matt

@MattGill98 MattGill98 self-assigned this Sep 7, 2018
@MattGill98 MattGill98 added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Enhancement Label issue as an enhancement request labels Sep 7, 2018
@smillidge
Copy link
Contributor

@jbee this is an old one do you think it will still be a problem?

@jbee
Copy link
Contributor

jbee commented Oct 29, 2019

@smillidge I believe we fixed this but I have to check.

@jbee
Copy link
Contributor

jbee commented Oct 31, 2019

@smillidge , @vassterg I was confusing this with another issue - @MattGill98 was and is correct in that we do not support subresources yet.

@rdebusscher
Copy link

Support for subresources is available in 5.194.

@fschuerer
Copy link

This does not work.
I have tested it with the provided maven sample with Payara 5.2021.7. and 5.194 The path /resources/foo/bar is missing in the openapi doc.

@rdebusscher rdebusscher reopened this Oct 21, 2021
@rdebusscher rdebusscher changed the title OpenAPI JAX-RS Incomplete subresource support OpenAPI JAX-RS Incomplete subresource support /FISH-5808 Oct 21, 2021
@rdebusscher
Copy link

An internal issue is created to research the JAX-RS subresources and the OpenAPI document relation in detail.

Thx
Rudy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Enhancement Label issue as an enhancement request
Projects
None yet
Development

No branches or pull requests

6 participants