Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add OpenAPI definition from file #17

Closed
artemklevtsov opened this issue Jul 16, 2018 · 1 comment
Closed

[Feature request] Add OpenAPI definition from file #17

artemklevtsov opened this issue Jul 16, 2018 · 1 comment

Comments

@artemklevtsov
Copy link
Collaborator

Add to add_route method the openapi_file param with OpenAPI definition YAML file.

@dselivanov
Copy link
Collaborator

Eventually I ended up with putting openapi to a separate yaml file using it as API definition. I found it is easier to maintain, so at the moment I almost don't use inline annotations inside functions:

app = RestRserve::RestRserveApplication$new()
PATH_TO_OPENAPI_DEFINITIONS_FILE = "openapi.yaml"
SWAGGER_UI_ENDPOINT_PATH = "/swagger"
OPENAPI_ENDPOINT_PATH = "/openapi.yaml"

app$add_static(path = OPENAPI_ENDPOINT_PATH, 
  file_path = PATH_TO_OPENAPI_DEFINITIONS_FILE, 
  content_type = "application/yaml")

app$add_swagger_ui(path = SWAGGER_UI_ENDPOINT_PATH,
                   path_openapi = OPENAPI_ENDPOINT_PATH)
app$run(8080)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants