Sign inSign up

contiamo/swagger-fixer

By contiamo

•Updated over 7 years ago

Container with json and json-schema tools used to clean up the pantheon generated swagger file.

Image
0

252

contiamo/swagger-fixer repository overview

Container with json and json-schema tools used to clean up the pantheon generated swagger file. Currently contains

  • jq
  • json-dereference-cli
  • json-schema-resolve-allof

We combine this with

jq 'delpaths([ ["paths"]])' target/swagger/swagger.json > components.temp.json \
    && json-dereference -s components.temp.json -o components.temp.json \
    && cat components.temp.json | json-schema-resolve-allof > components.json \
    && jq '.components |= $a[0].components' --slurpfile a components.json target/swagger/swagger.json  > out.json \
    && jq '.paths |= $b[0]' --slurpfile b <(jq '.paths | with_entries(.key |= "/api/v1" + .)' out.json) out.json \
    | sed -E -e 's/(([a-zA-Z]+)\.)+([a-zA-Z]+)/\3/g' > docs/swagger.json

to dereference and simplify the schema types. This ensures that swagger code generators produce reasonably good code for JavaScript and Go.

Tag summary

Content type

Image

Digest

Size

-

Last updated

over 7 years ago

docker pull contiamo/swagger-fixer