Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Lost API #35

Closed
schlagi123 opened this issue Nov 16, 2020 · 1 comment · Fixed by #40
Closed

Lost API #35

schlagi123 opened this issue Nov 16, 2020 · 1 comment · Fixed by #40
Labels
bug Something isn't working
Milestone

Comments

@schlagi123
Copy link

If I use the following YAML:

openapi: 3.0.2
info:
  title: name me
  version: 1.0.0

paths:
  /api/test1:
    get:
      summary: Test.
      operationId: test_1
      tags:
        - test_api
      responses:
        200:
          description: Test
 
  /api/test2:
    get:
      summary: Test.
      operationId: test_2
      tags:
        - test-api
      responses:
        200:
          description: Test

The difference of the apis are the tag (test_api and test-api).
One api of the two is lost in the result. I had excepted, that I get...

  • 2 Interfaces,
  • 1 Interface with both apis or
  • an error

But currently one api is lost.

@hauner hauner transferred this issue from openapi-processor/openapi-processor-gradle Nov 16, 2020
@hauner
Copy link
Member

hauner commented Nov 16, 2020

The processor uses the first tag to create the interface name. To create a valid java identifier it drops the - in test-api and the _ in test_api finally using TestApi as the interface name.

Hmm, looking at the code it is using the raw tag names (i.e. test-api) to collect the methods of an interface and the java identifier to generate the source file. It means that the first interface is probably lost because it gets overwritten by the second with the same name.

The fix (using the java identifier to select the target interface) will add both endpoints to the same interface.

@hauner hauner added the bug Something isn't working label Nov 16, 2020
@hauner hauner added this to the 2020.4.0 milestone Nov 29, 2020
@hauner hauner linked a pull request Nov 29, 2020 that will close this issue
Merged
hauner added a commit that referenced this issue Nov 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants