Skip to content

Commit

Permalink
[OpenAPI] Add Dockerfile to reliability generate the OpenAPI spec u…
Browse files Browse the repository at this point in the history
…sing `ignite` (#1055)

## Summary

Adds a Dockerfile to build the outputted OpenAPI spec in a way that will
work on all dev environments.


## Issue

-
https://discord.com/channels/824324475256438814/997192534168182905/1336447458128957523
- #1054 
- #988
- ignite/cli#4495

## Type of change

Select one or more from the following:

- [x] New feature, functionality or library
- [ ] Consensus breaking; add the `consensus-breaking` label if so. See
#791 for details
- [ ] Bug fix
- [x] Code health or cleanup
- [ ] Documentation
- [ ] Other (specify)

## Sanity Checklist

- [ ] I have updated the GitHub Issue `assignees`, `reviewers`,
`labels`, `project`, `iteration` and `milestone`
- [ ] For docs, I have run `make docusaurus_start`
- [ ] For code, I have run `make go_develop_and_test` and `make
test_e2e`
- [ ] For code, I have added the `devnet-test-e2e` label to run E2E
tests in CI
- [ ] For configurations, I have update the documentation
- [ ] I added TODOs where applicable

---------

Co-authored-by: Daniel Olshansky <[email protected]>
  • Loading branch information
commoddity and Olshansk authored Feb 5, 2025
1 parent c5d200b commit 9f19047
Show file tree
Hide file tree
Showing 4 changed files with 48,031 additions and 2 deletions.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,23 @@ ignite_poktrolld_build: check_go_version check_ignite_version ## Build the poktr
ignite chain build --skip-proto --debug -v -o $(shell go env GOPATH)/bin

.PHONY: ignite_openapi_gen
ignite_openapi_gen: ## Generate the OpenAPI spec for the Ignite API
ignite_openapi_gen: ## Generate the OpenAPI spec natively and process the output
ignite generate openapi --yes
$(MAKE) process_openapi

.PHONY: ignite_openapi_gen_docker
ignite_openapi_gen_docker: ## Generate the OpenAPI spec using Docker and process the output; workaround due to https://github.com/ignite/cli/issues/4495
docker build -f ./proto/Dockerfile.ignite -t ignite-openapi .
docker run --rm -v "$(PWD):/workspace" ignite-openapi
$(MAKE) process_openapi

.PHONY: process_openapi
process_openapi: ## Ensure OpenAPI JSON and YAML files are properly formatted
# The original command incorrectly outputs a JSON-formatted file with a .yml extension.
# This fixes the issue by properly converting the JSON to a valid YAML format.
mv docs/static/openapi.yml docs/static/openapi.json
yq -o=json '.' docs/static/openapi.json -I=4 > docs/static/openapi.json.tmp && mv docs/static/openapi.json.tmp docs/static/openapi.json
yq -P -o=yaml '.' docs/static/openapi.json > docs/static/openapi.yml

##################
### CI Helpers ###
Expand Down
Loading

0 comments on commit 9f19047

Please sign in to comment.