OpenAPITools / OpenAPITools/openapi-generator
[BUG][html2] HTML2-Generator not displaying query parameters properly
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
html2 generator ignores "default" and "enum" field and the resulting url is missing a value for the query parameter.
openapi-generator version
5.1.0
OpenAPI declaration file content or url
"servers" : [ {
"url" : "https://my-cookies/"
} ],
"paths" : {
"/api/v4/cookies/amount" : {
"get" : {
"summary" : "Summary",
"description" : "Description",
"operationId" : "get_amount",
"parameters" : [{
"name" : "color",
"in" : "query",
"description" : "Cookie color",
"schema" : {
"type" : "string",
"default" : "red",
"enum" : [ "red", "blue", "green", "yellow" ]
}
} ],
The entire json file and the resulting index.html file can be found here: https://gist.github.com/kas1337/7381b3764fdfe340e272958e5a9a19b8
Generation Details & Steps to reproduce
I've tested with the latest master branch as described here https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator using the following command (Linux)
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g html2 -i openapi.json
Actual output
The resulting url in the generated documentation is missing the query parameter.
/api/v4/cookies/amount
In the CURL example the query parameter is visible but it looks like it's missing a value
curl -X GET\
-H "Accept: application/pdf,application/json"\
"https://my-cookies/api/v4/cookies/amount?color="
Furthermore, the "default" and "enum" fields are missing in the parameters section. Only the description is displayed.
Expected output
I would expect something like this for the url
/api/v4/cookies/amount?color={example_color}
as well as for the CURL example.
It would be nice if you could have a look into this. Thanks!
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 by running the supplied html2 generation command with the OpenAPI declaration from the issue and compare the generated index.html with the linked gist. Trace the html2 generator's parameter rendering from the generated URL and CURL example; done means the query value is represented and the default and enum fields appear in the parameters section.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100