Swagger-editor: Environment variable to import json or yaml

Created on 13 Mar 2018  路  10Comments  路  Source: swagger-api/swagger-editor

| Q | A
| ----------------------------------- | -------
| Bug or feature request? | feature request
| Which Swagger/OpenAPI version? |
| Which Swagger-Editor version? |
| How did you install Swagger-Editor? | docker
| Which browser & version? | Chrome Version 62.0.3202.89 (Official Build) (64-bit)
| Which operating system? | Ubuntu

Current Behavior



Able to install docker image and run using docker run -d -p 80:8080 swaggerapi/swagger-editor

Possible Solution



Should be able to import json on start
docker run -d -p 80:8080 -e SWAGGER_JSON='./swagger.json' swaggerapi/swagger-editor

Context



Trying to start fresh with provided json instead of starting editor and importing everytime. I am limited to docker only run

docker enhancement

Most helpful comment

Sorry, I've been away from this almost a year and still seeing this open. I've opened a PR that fixes it. Please approve

All 10 comments

That would be awesome. I have spent couple of hours trying to figure this out.
Other solution would be to document how the first petstore default is loaded, and if loaded from the docker file system we could mount host file to this file on docker.

swagger-ui has a similar feature which is achieved with a environmental variable called SWAGGER_JSON though I cannot find an official document about it.

I think we could apply the idea of swagger-ui into this issue as well. Let me dig it.

The 2.x editor had some configuration options that allowed it to be integrated in a project ie. https://github.com/Rebilly/swagger-repo/blob/master/lib/editor_config.json

disableFileMenu and backendEndpoint are the most important parameters for this to work. I checked the code of the 3.x version and it does not support those options (yet).

Any update on this? It would be really nice to have this, since Swagger UI comes with it already.

@codeasashu, the proposed command should probably include a volume mount like -v $(pwd):/tmp and -e SWAGGER_JSON=/tmp/swagger.json (or openapi.yaml) would then reference that path.

Please add this feature
Petstore example isn't that exciting :)

It's a good suggestion overall. PRs are welcome 馃槂

Sorry, I've been away from this almost a year and still seeing this open. I've opened a PR that fixes it. Please approve

@webron any plans to merge it? very useful feature

Yeah, we're slowly catching up on PRs. Apologies for the delay and thanks for the contribution!

@webron is there anything I can in order to help to promote it? Since I see that pr is open for a long time

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weldpua2008 picture weldpua2008  路  6Comments

variable picture variable  路  4Comments

korenlev picture korenlev  路  4Comments

confuser picture confuser  路  6Comments

freak4pc picture freak4pc  路  3Comments