openapi2jsonschema icon indicating copy to clipboard operation
openapi2jsonschema copied to clipboard

Generate from a local file schema

Open nikolay opened this issue 6 years ago • 2 comments
trafficstars

Using the file: protocol doesn't seem to work. It errors out like this:

FATA[0000] generate lib                                  error="import Kubernetes spec: load schema from path: Get http://localhost:8001/swagger.json: dial tcp [::1]:8001: connect: connection refused"

nikolay avatar Dec 24 '18 16:12 nikolay

Doesn't seem to work with remote ether:

The snippet:

local -r schema="https://raw.githubusercontent.com/kubernetes/kubernetes/v${kubernetes_version}/api/openapi-spec/swagger.json"
pushd "${schema_dir}"
rm -rf "${schema_dir}"
mkdir -p "${schema_dir}"
openapi2jsonschema \
    --kubernetes \
    --stand-alone \
    "${schema}"
popd

returns tons of:

Processing storageclasslist
An error occured processing storageclasslist: URLError: <urlopen error [Errno 21] Is a directory: '/Users/.../schema/schemas/'>

with a lot of empty (0-byte) schema files.

nikolay avatar Dec 24 '18 17:12 nikolay

to use local file you must use file protocol: file:///AbsolutePath

poutysquire10 avatar Jan 13 '19 18:01 poutysquire10