Reputation: 118
I created a swagger.json using the open-api-3 standart to be able to generate a client-sdk using the tool swagger-codegen. My problem is that each API-endpoint ends up getting its own api-object instead of one api object for all endpoints of the api.
Expected:
$api->getArticles();
$api->getUsers();
Actual:
$articleApi->getArticles();
$userApi->getUsers();
Question: How can I configure swagger codegen or my swagger.json to create only one api object for all entities/resources?
I used https://editor.swagger.io/ to generate the sdk in this example but I had the same result with the offline java version.
Here is my swagger.json : https://pastebin.com/kDZpSDtc
Upvotes: 0
Views: 673
Reputation: 1
Remove "tags" with its content. I don't know what other code-generation settings there are in php, but in java pom.xml there is also a setting true If you remove it or set to false, it generates one Api class.
yaml:
put:
summary: Getting something from DB
operationId: produced
tags: <--remove
**- getting** <--remove
requestBody:
pom.xml:
<configOptions>
<useTags>true</useTags> <--remove or 'false'
<library>spring-mvc</library>
<dateLibrary>java8-localdatetime</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
</configOptions>
Upvotes: 0