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

Generate API documentation using Golang #15788

Merged
merged 2 commits into from
Aug 24, 2017

Conversation

jim-minter
Copy link
Contributor

@bparees this is imperfect, but I believe it's a strong enough starting point for further work and a line has to be drawn somewhere. PTAL.

@openshift-merge-robot openshift-merge-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 16, 2017
@bparees
Copy link
Contributor

bparees commented Aug 16, 2017

@jim-minter can you break this PR down into separate commits for the infrastructure changes to how generation is done, and the new generated content?

@bparees
Copy link
Contributor

bparees commented Aug 16, 2017

also @openshift/api-review ptal at these improvements to the api doc generation/output that @jim-minter has made.

@jim-minter
Copy link
Contributor Author

@bparees done

@bparees
Copy link
Contributor

bparees commented Aug 16, 2017

lgtm but definitely needs sign off from @openshift/api-review imho

hack/apidocs.go Outdated
@@ -0,0 +1,56 @@
package main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected it under tools

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved

hack/apidocs.go Outdated
return err
}

doc, err := loads.JSONSpec("api/swagger-spec/openshift-openapi-spec.json")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from a file instead of the server? What does the file combine (for those who don't recall)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a dump of https://localhost:8443/swaggerapi which is already checked into the repo and kept up-to-date via make update/verify.

l.Lines = buildLines(s, s.Definitions[RefType(&property)], prefix+" ")
}
lines = append(lines, l)
prefix = strings.Replace(prefix, "-", " ", -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me tingle. Didn't we already use this value? Seems weird to change it once after the first usage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's hacky but I believe it's functionally correct. The intention is to handle the initial hyphens correctly in the pseudo-yaml that is being output here. I didn't come up with a better way.

@deads2k
Copy link
Contributor

deads2k commented Aug 16, 2017

I like the idea. I don't know enough about the history of original to approve it though.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 18, 2017
@jim-minter jim-minter removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 18, 2017
@bparees
Copy link
Contributor

bparees commented Aug 22, 2017

/lgtm
/retest

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2017
@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 22, 2017
@bparees
Copy link
Contributor

bparees commented Aug 22, 2017

(we're prepared for/anticipating followups to this, but it's a good stake in the ground)

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 23, 2017
@jim-minter
Copy link
Contributor Author

@bparees repushed having just rebased and run hack/update-generated-swagger-spec.sh ; please re-lgtm

@bparees
Copy link
Contributor

bparees commented Aug 23, 2017 via email

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 23, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, jim-minter

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@jim-minter
Copy link
Contributor Author

/retest

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 15870, 15888, 15788, 15907, 15936)

@openshift-merge-robot openshift-merge-robot merged commit dbc90ff into openshift:master Aug 24, 2017
@openshift-ci-robot
Copy link

@jim-minter: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_conformance_gce 2b91d4d link /test extended_conformance_gce

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants