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

Upgrade Pender service to provide a UI to its API via OpenAPI #8

Closed
infojunkie opened this issue Sep 17, 2020 · 5 comments · Fixed by meedan/pender#233
Closed

Upgrade Pender service to provide a UI to its API via OpenAPI #8

infojunkie opened this issue Sep 17, 2020 · 5 comments · Fixed by meedan/pender#233
Assignees
Labels
Component: Pender Link parsing and archiving service at https://github.com/meedan/pender Difficulty: Intermediate HacktoberFest Tech: Ruby/Rails

Comments

@infojunkie
Copy link
Contributor

infojunkie commented Sep 17, 2020

Tell us about your request
Pender currently uses Swagger 0.x to expose its API on a web page. Upgrade Swagger to use the latest version of OpenAPI (3.x). Evaluate OpenAPI Generator as possible technology.

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
Testing and debugging an API during development is much easier when a UI exists to make API calls.

@infojunkie infojunkie added Component: Pender Link parsing and archiving service at https://github.com/meedan/pender Difficulty: Intermediate Tech: Ruby/Rails HacktoberFest labels Sep 17, 2020
@daniel-shuy
Copy link

I'd like to attempt this

@daniel-shuy
Copy link

daniel-shuy commented Oct 9, 2020

I tried using rswag to generate Swagger YAML/JSON and swagger-ui from rspec-rails specifications.

So far it works well, the only issue is that rswag does not provide a way to convert OpenAPI 3.x JSON/YAML files to Markdown, to replace swagger-docs Swagger JSON to Markdown functionality, which is currently used to generate pender/doc/api.md. Is this an acceptable tradeoff?

@daniel-shuy
Copy link

daniel-shuy commented Oct 11, 2020

Apparently pender/doc/api.md is no longer in line with the Swagger JSON anyways, so one option is to get rid of the api.md Makefile task but keep the api.md file (since the api.md Makefile task is unusable now anyways).

Alternately, we can use widdershins to convert OpenAPI 3.x JSON/YAML files to Markdown, and update the new OpenAPI definition to match the current api.md. This however requires npm.

Since this will potentially require a lot more effort, I will need a confirmation before continuing to work on this.

So far I've successfully used rswag to generate OpenAPI 3.x YAML/JSON files for the controllers, and displayed them using rswag's embedded swagger-ui. Now I'm migrating the existing controller tests (https://github.com/meedan/pender/tree/v0.113.0/test/controllers) to use rswag (which uses rspec-rails internally).

@danielafeitosa
Copy link
Contributor

Hi @daniel-shuy,
Thank you for your interest!

So far I've successfully used rswag to generate OpenAPI 3.x YAML/JSON files for the controllers, and displayed them using rswag's embedded swagger-ui. Now I'm migrating the existing controller tests (https://github.com/meedan/pender/tree/v0.113.0/test/controllers) to use rswag (which uses rspec-rails internally).

Yes, it's an acceptable tradeoff and a great contribution.

Alternately, we can use widdershins to convert OpenAPI 3.x JSON/YAML files to Markdown, and update the new OpenAPI definition to match the current api.md. This however requires npm.
Since this will potentially require a lot more effort, I will need a confirmation before continuing to work on this.

You can keep working in this solution, it seems to be a good approach

@daniel-shuy
Copy link

@danielafeitosa Thanks for the confirmation! I've created a PR at meedan/pender#233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Pender Link parsing and archiving service at https://github.com/meedan/pender Difficulty: Intermediate HacktoberFest Tech: Ruby/Rails
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants