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

[WIP] Swagger for the API #180

Closed
wants to merge 12 commits into from

Conversation

Skarlso
Copy link
Member

@Skarlso Skarlso commented Apr 7, 2019

Started working on Swaggering up the API. Also updated to echo v4 for maximum module usage. ( and because the handler is using v4... grump grump )

@Skarlso Skarlso added the Needs Work The PR still requires some work from the submitter. label Apr 7, 2019
@Skarlso
Copy link
Member Author

Skarlso commented Apr 7, 2019

Deals with #150.

@codecov-io
Copy link

codecov-io commented Apr 7, 2019

Codecov Report

Merging #180 into master will decrease coverage by 1.26%.
The diff coverage is 55.62%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #180      +/-   ##
==========================================
- Coverage   62.27%   61.01%   -1.27%     
==========================================
  Files          47       49       +2     
  Lines        3828     4266     +438     
==========================================
+ Hits         2384     2603     +219     
- Misses       1053     1220     +167     
- Partials      391      443      +52
Impacted Files Coverage Δ
helper/pipelinehelper/pipelinehelper.go 100% <ø> (ø) ⬆️
store/pipeline.go 62.02% <0%> (-5.1%) ⬇️
handlers/user.go 39.68% <0%> (ø) ⬆️
handlers/pipeline_run.go 0% <0%> (ø) ⬆️
workers/scheduler/create_cmd.go 62.5% <0%> (-11.28%) ⬇️
handlers/hook.go 63.15% <100%> (ø) ⬆️
workers/pipeline/build_nodejs.go 100% <100%> (ø)
handlers/vault.go 57.37% <100%> (ø) ⬆️
security/vault.go 75% <100%> (-3.58%) ⬇️
handlers/workers.go 48.12% <100%> (ø) ⬆️
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d09d3f2...0a75df4. Read the comment docs.

@Skarlso
Copy link
Member Author

Skarlso commented Apr 7, 2019

This is going to be a massive amount of frigging typing... :D :D :D

Screenshot 2019-04-07 at 21 35 15

Screenshot 2019-04-07 at 21 35 06

@Skarlso
Copy link
Member Author

Skarlso commented Apr 7, 2019

This also needs a docs Pr describing how to update the swagger doc.

For now, I'm following the annotation outlined here: https://github.com/swaggo/swag#declarative-comments-format

To generate the docs, stand in the root folder and run:

swag init -g ./cmd/gaia/main.go

@michelvocks
Copy link
Member

Cool. Good job @Skarlso

Do you know what the outcome is when you generate the docs? Is it a static HTML website?
We are currently using netlify as a host for our docs + website and want to make sure that we can still use that. 😄

@Skarlso
Copy link
Member Author

Skarlso commented Apr 9, 2019

I think I can get Swagger to generate static HTML. At least I know there is an option for that. :D I have no idea how well that works. :)

Right now, as you can see, it's a go file actually. :)

@Skarlso
Copy link
Member Author

Skarlso commented Apr 11, 2019

BTW. So right now basically the app is hosting its own documentation. Basically if you have a running Gaia instance you can access the api by going to gaia.org/swagger. Bumm instant living docs. Also useful for development.

But I agree that a static generated doc on a hosted site would be also cool.

@michelvocks
Copy link
Member

@Skarlso Yeah that's cool. But in the end, we need a hosted website where you can check the API from Gaia. 👍

@Skarlso
Copy link
Member Author

Skarlso commented Jun 30, 2019

Oh Gods. So much conflict on this now. :D

@Skarlso
Copy link
Member Author

Skarlso commented Jun 30, 2019

I'm going to close this one and re-open with the few changes. It's easier than trying to resolve all the conflicts.

@Skarlso
Copy link
Member Author

Skarlso commented Jun 30, 2019

Actually wasn't that hard. The go.mod and go.sum file might be off.

@Skarlso
Copy link
Member Author

Skarlso commented Jun 30, 2019

Alright. Going to continue doing this.

@Skarlso
Copy link
Member Author

Skarlso commented Jun 30, 2019

Hah, made it recognise the auth method.

curl -X GET "http://gaia-pipeline.io/api/v1/users" -H "accept: application/json" -H "Authorization: Bearer ASDFASDF="

Swagger generated get there.

@Skarlso Skarlso closed this Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Work The PR still requires some work from the submitter.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants