Skip to content

Commit

Permalink
ci: install swagger-mock-validator globally
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed May 13, 2024
1 parent a0b3530 commit 7876015
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ jobs:
# - run: make do_provider_test
- run: make do_generate_consumer
- run: make do_consumer_test
# - run: make do_consumer_pact_verify_openapi
- run: |
cat openapi/openapi.yaml
cat typescript-fetch-pact-consumer/pacts/DefaultApi-consumer-DefaultApi.json
- run: npx --yes @pactflow/swagger-mock-validator openapi/openapi.yaml typescript-fetch-pact-consumer/pacts/DefaultApi-consumer-DefaultApi.json
- run: make do_consumer_pact_verify_openapi
# - run: |
# cat openapi/openapi.yaml
# cat typescript-fetch-pact-consumer/pacts/DefaultApi-consumer-DefaultApi.json
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ do_soapui_test: soapui_run ## Run SoapUI test suite

do_generate_consumer: swagger_codegen_cli_fetch swagger_codegen_generators_fetch swagger_codegen_generators_build swagger_codegen_generators_generate consumer_project_install ## Generate consumer project
do_consumer_test: consumer_project_test ## Test consumer
do_consumer_pact_verify_openapi: consumer_project_verify_pact_openapi ## Verify consumer with Pact and OpenAPI
do_consumer_pact_verify_openapi: install_swagger_mock_validator consumer_project_verify_pact_openapi ## Verify consumer with Pact and OpenAPI

do_generate_provider: provider_project_fetch provider_project_install ## Generate provider project
do_provider_test: provider_start_test_stop ## Test provider
Expand Down Expand Up @@ -138,7 +138,7 @@ swagger_codegen_generators_fetch: ## Get a fork of Swagger-Code-Generators conta
git clone -b typescript-fetch-pact https://github.com/you54f/swagger-codegen-generators

swagger_codegen_generators_build: ## Build the swagger-codegen-generators project with Java
cd swagger-codegen-generators && mvn package
cd swagger-codegen-generators && jenv local 1.8 || echo "jenv not found" && mvn package

swagger_codegen_generators_generate: ## Generate a templated project from a given OpenAPI specification
echo '{ "npmName": "typescript-fetch-pact-consumer" }'>codegen.config.json
Expand All @@ -151,8 +151,11 @@ consumer_project_install: ## Install the templated project
consumer_project_test: ## Test the templated project with Pact
cd typescript-fetch-pact-consumer && npm test

install_swagger_mock_validator:
npm -g install @pactflow/swagger-mock-validator

consumer_project_verify_pact_openapi: ## Verify the templated project with Pact and OpenAPI
npx --yes @pactflow/swagger-mock-validator openapi/openapi.yaml typescript-fetch-pact-consumer/pacts/DefaultApi-consumer-DefaultApi.json
swagger-mock-validator openapi/openapi.yaml typescript-fetch-pact-consumer/pacts/DefaultApi-consumer-DefaultApi.json

################################
### API Func Testing - SoapUI ###
Expand Down

0 comments on commit 7876015

Please sign in to comment.