Reputation: 571
I am playing around with https://openapi-generator.tech/ and I have an example openapi.yaml
file:
openapi: 3.1.0
info:
title: Sample API
description: My amazing description.
version: 0.0.9
servers:
- url: http://localhost:8080/v1
description: My amazing server description.
paths:
/users:
get:
summary: Returns a list of all users.
description: My amazing /users endpoint description.
responses:
"200":
description: (OK) A JSON array of user objects.
content:
application/json:
schema:
type: array
items:
type: string
I have tried the following generation command:
openapi-generator-cli generate -g go-gin-server --global-property=apiDocs=true -i ./openapi.yaml
both with, and without the --global-property=apiDocs=true
part. Neither case generated an /api
, /doc
, or /docs
endpoint.
What am I doing wrong?
Note that the server runs fine, i.e., I can curl
the endpoints specified in the yaml
file.
Upvotes: 0
Views: 854
Reputation: 641
It doesn't look like the server stub generator go-gin-server
supports adding this type of endpoint. If you look at the routers template that this generator uses you can see that no config option will generate an /api
, /doc
or /docs
endpoint unless you have defined it in your spec.
It's not clear to me exactly what you are expecting from this endpoint, but you could define one of these endpoints in your spec and implement the behavior you would like, or you could customize the template to automatically add this endpoint during code generation
Upvotes: 1