swagger-api / swagger-api/swagger-codegen
[Python] Selecting Endpoint for the README example
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Is there a way to select which endpoint is used to generate the example for the README?
It looks like the current method sorts by tag and operationID and selects the first one to generate an example for.
Given the following paths and tags (spec kept minimal to illustrate issue and is not valid):
paths:
"/z1/":
get:
operationId: z1
tags:
- Z
"/z2/":
get:
operationId: z2
tags:
- Z
"/a2":
get:
operationId: a2
tags:
- A
"/a1/":
get:
operationId: a1
tags:
- A
The generated README will contain an example similar to:
from __future__ import print_function
import time
import swagger_api
from swagger_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_api.AApi()
try:
# Check if server is responding to queries.
api_instance.a1()
except ApiException as e:
print("Exception when calling AdminApi->ping: %s\n" % e)
What I want instead is for the example to use ZApi().z2().
Swagger-codegen version
2.3.0
Swagger declaration file content or url
https://api.swaggerhub.com/apis/cyledoux/cythereal-magic-api/1/swagger.json
Command line used for generation
docker run --rm -v $HOME/clients:/local swaggerapi/swagger-codegen-cli generate -i https://api.swaggerhub.com/apis/cyledoux/cythereal-magic-api/1/swagger.json -l python -o /local/clients/python --config=/local/config/python.json
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied Docker generation command and trace how the Python README example chooses and sorts endpoints. Confirm how configuration is passed to the generator, then define completion as allowing the example to select the requested ZApi().z2() endpoint instead of the current first endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100