Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swaggerexpert/swagger-editor-validate
This GitHub Actions validates OpenAPI (OAS) definition file using Swagger Editor.
https://github.com/swaggerexpert/swagger-editor-validate
editor openapi openapi2 openapi3 openapi31 swagger validate validations
Last synced: about 1 month ago
JSON representation
This GitHub Actions validates OpenAPI (OAS) definition file using Swagger Editor.
- Host: GitHub
- URL: https://github.com/swaggerexpert/swagger-editor-validate
- Owner: swaggerexpert
- License: bsd-3-clause
- Created: 2021-03-05T18:37:29.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-12-13T04:18:27.000Z (about 1 month ago)
- Last Synced: 2024-12-13T05:19:08.475Z (about 1 month ago)
- Topics: editor, openapi, openapi2, openapi3, openapi31, swagger, validate, validations
- Language: JavaScript
- Homepage: https://github.com/swaggerexpert/swagger-editor-validate
- Size: 1.84 MB
- Stars: 48
- Watchers: 5
- Forks: 12
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Governance: GOVERNANCE.md
Awesome Lists containing this project
README
# Swagger Editor Validate Github Action
This GitHub Action validates OpenAPI (OAS) definition file using [Swagger Editor](https://editor.swagger.io/).
![test](https://user-images.githubusercontent.com/193286/110246148-b7aea580-7f66-11eb-9bd7-940ece1fc6b0.png)
It's handy for use-cases when OAS definition is maintained manually and is checked within the git.
If modifications are made to the OAS definition you want to make sure that there are no errors
introduced by modifications. Errors that would appear in Swagger Editor when the OAS definition
would be pasted inside it.![image](https://user-images.githubusercontent.com/193286/110244618-dcebe580-7f5f-11eb-8dd8-cb31f499761e.png)
If you're interested about technical design and evolution of this GitHub Action please
read our [release article](https://vladimirgorej.com/blog/how-to-validate-openapi-definitions-in-swagger-editor-using-github-actions/).## Inputs
### `swagger-editor-url`
**Optional** Defines URL of [swagger-editor](https://www.npmjs.com/package/swagger-editor) where definition
file is going to be validated. Default `https://editor.swagger.io/`.### `definition-file`
**Required** Defines path of [OAS](https://github.com/OAI/OpenAPI-Specification) definition file that exists
as a physical file in your repository.### `ignore-error`
**Optional** Defines path to JavaScript file containing predicate for determining if the error should be ignored or not.
## Example usage
There are two major use-cases of how to use this GitHub Action.
### Public use-case
If you have access to the internet and don't mind that this action sends your OAS definition
to https://editor.swagger.io/ for validation.```yaml
on: [push]jobs:
test_swagger_editor_validator_remote:
runs-on: ubuntu-latest
name: Swagger Editor Validator Remotesteps:
- uses: actions/checkout@v2
- name: Validate OpenAPI definition
uses: swaggerexpert/swagger-editor-validate@v1
with:
definition-file: examples/openapi-2-0.yaml
```### Private use-case
If you want to maintain complete privacy and your OAS definition may contain
sensitive information use the following workflow. The workflow uses swagger-editor
docker image that runs as service of the workflow.```yaml
on: [push]jobs:
test_swagger_editor_validator_service:
runs-on: ubuntu-latest
name: Swagger Editor Validator Service# Service containers to run with `runner-job`
services:
# Label used to access the service container
swagger-editor:
# Docker Hub image
image: swaggerapi/swagger-editor
ports:
# Maps port 8080 on service container to the host 80
- 80:8080steps:
- uses: actions/checkout@v2
- name: Validate OpenAPI definition
uses: swaggerexpert/swagger-editor-validate@v1
with:
swagger-editor-url: http://localhost/
definition-file: examples/openapi-2-0.yaml
```