Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Management API OpenAPI document is not valid #405

Open
duuri-mollinen opened this issue Nov 9, 2022 · 6 comments
Open

Management API OpenAPI document is not valid #405

duuri-mollinen opened this issue Nov 9, 2022 · 6 comments
Labels

Comments

@duuri-mollinen
Copy link

https://docs.lavinmq.com/http-api.html -> download -> https://editor.swagger.io ->
Screenshot 2022-11-09 at 11 43 36

@dentarg
Copy link
Member

dentarg commented Nov 9, 2022

Thanks for reporting @duuri-mollinen

Interesting, we do lint with https://github.com/stoplightio/spectral

echo "Linting HTTP API documentation"
test -t 1 && USE_TTY="--tty" || true
docker run --rm ${USE_TTY:-} -v $(pwd):/tmp stoplight/spectral:6 \
--ruleset /tmp/openapi/.spectral.json \
lint openapi/openapi.yaml

Maybe Spectral can't catch errors like these? Do you know if it is possible to lint with swagger-ui (or some other tool from the swagger project)? We would like to be able to run it command line.

The JSON you can download is provided by redoc-cli as part of the generated docs

lavinmq/Makefile

Lines 35 to 36 in 9eab401

static/docs/index.html: openapi/openapi.yaml $(wildcard openapi/paths/*.yaml) $(wildcard openapi/schemas/*.yaml)
npx redoc-cli build $< -o $@

but I checked the first error here and indeed items is missing here:

partitions:
type: array

@duuri-mollinen
Copy link
Author

That at least claims do the trick https://github.com/char0n/swagger-editor-validate I'm not sure about your tool chain, if that's directly suitable or not

@jage jage added the bug label Nov 10, 2022
@dentarg
Copy link
Member

dentarg commented Nov 11, 2022

Thanks for that tip, I see it runs Swagger UI using Chrome headless via Puppeteer 😮 Not sure we want to go down that route, I'll need to do some research

@dentarg
Copy link
Member

dentarg commented Nov 11, 2022

Tried https://github.com/APIDevTools/swagger-cli but it does not catch these errors

$ docker run -it --rm -v $(pwd):/app -w /app node:16 bash
...
root@53ddb7f05dac:/app# npm install -g @apidevtools/swagger-cli
...
root@53ddb7f05dac:/app# swagger-cli validate openapi/openapi.yaml
openapi/openapi.yaml is valid

Tried with too APIDevTools/swagger-cli#78 , didn't help

@dentarg
Copy link
Member

dentarg commented Nov 12, 2022

This seems to be something at least (no line numbers given put those aren't really relevant anyway as the source is YAML), still an open question is how to produce the JSON in CI (and put it online?)

@dentarg
Copy link
Member

dentarg commented Jul 31, 2023

Looks like it is https://github.com/swagger-api/validator-badge that's powering https://validator.swagger.io/, possible to run using Docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants