Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ramsailopal/specmatic
A docker image for Specmatic
https://github.com/ramsailopal/specmatic
openapi specmatic
Last synced: about 5 hours ago
JSON representation
A docker image for Specmatic
- Host: GitHub
- URL: https://github.com/ramsailopal/specmatic
- Owner: RamSailopal
- Created: 2023-08-29T08:35:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-29T12:06:29.000Z (about 1 year ago)
- Last Synced: 2023-08-29T18:43:14.653Z (about 1 year ago)
- Topics: openapi, specmatic
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A docker image for Specmatic
![example workflow](https://github.com/RamSailopal/Specmatic/actions/workflows/docker.yml/badge.svg)
This repo contains a Docker build file for Specmatic as well as examples with local and remote OpenAPI files.
## Setup
To set up a Dockerised Specmatic environment locally, run:
git clone https://github.com/RamSailopal/Specmatic.git
cd Specmatic/Example
alias specmatic="docker run --rm -it -v "$PWD:/home/Example" ramb0/specmatic"
alias specmatic-serv="docker run --rm -it -p 9000:9000 -v "$PWD:/home/Example" ramb0/specmatic"## Local OpenAPI file
An example OpenAPI file for a simple pets API has been created - **Example/service.yaml** Another file for "canned responses" has been also been created - **Example/scooby.json**
To run a "stub server" for the API on port 9000, run:
specmatic-serv stub service.yaml
To test the API, you first need the local network accessible IP address of the host machine:
Linux -
ip add show
Windows -
ipconfig
Once this has been attained, run:
specmatic test service.yaml --host
i.e.
specmatic test --host 172.28.61.122
## OpenAPI file stored in a separate centralised repo
References to a centralised repo can be made in the setup through the file **Example/specmatic.json**
As an example, references to an openAPI file in the Specmatic repo have been made - https://github.com/znsio/specmatic-order-contracts/blob/main/in/specmatic/examples/store/api_order_v1.yaml
When running Specmatic with a specmatic.json configured, there is no need to specify the location of the local OpenAPI file and so, to run the stub command with the process listening on port 9000, use:
specmatic-serv stub
To run all other processes i.e test, use:
specmatic test --host
## References
**Docker Hub** - https://hub.docker.com/repository/docker/ramb0/specmatic/general
**Specmatic** - https://github.com/znsio/specmatic-documentation
**OpenAPI** - https://www.openapis.org/