as command (swaggerknife)¶
- json2swagger
- flatten
json2swagger¶
Generating swagger spec from data.
input data
$ swaggerknife json2swagger config.json --name config --dst config-spec.yaml
config-spec.yaml
with multiple sources¶
with multiple sources, required option detection is more accrurately.
input data
person-foo.json
person-bar.json
$ swaggerknife json2swagger person-foo.json person-bar.json --name person --dst person-spec.yaml
person-spec.yaml
01person-bar.json doesn’t have nickname and nickname is not reuired in generated spec.
with —annotate option¶
with annotation file.
with-annotations.yaml
annotations.yaml
swaggerknife json2swagger with-annotations.yaml --annotate=annotations.yaml --name Top --dst with-annotations-spec.yaml
with-annotations-spec.yaml
flatten¶
only swagger like structure (toplevel is #/definitions).
$ tree src
src/
└── abc.yaml
$ mkdir -p dst
$ jsonknife flatten --src src/abc.yaml --dst dst/abc.yaml
src/abc.yaml
dst/abc.yaml