-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Documentation: add document on the dex API #652
Conversation
08b1cd0
to
cf79f10
Compare
cf79f10
to
eb02cb1
Compare
@ElijahCaine ptal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good so far. Just a few small pieces of feedback.
|
||
## Generating clients | ||
|
||
gRPC is a suite of tools for generating client and server bindings from a common declarative language. The canonical schema for dex's API can be found in the source tree at `api/api.proto`. Go bindings are generated and maintained in the same directory for internal use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make api/api.proto
a link to the file on GitHub for convenience.
Most readers will expect that reference to be linked.
To generate a client for your own project install [`protoc`][protoc], install a protobuf generator for your project's language, and download the `api.proto` file. An example for a Go project: | ||
|
||
``` | ||
# Install protoc-gen-go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are shell commands they should begin with $
. If it's a script make that clear. I like annotating it like this:
script-name.sh
:
# script contents
...
But anything that makes it clear works for me.
protoc --go_out=import_path=dexapi:. api.proto | ||
``` | ||
|
||
Client programs can them be written using the generated code. A Go client which uses dex's internally generated code might look like the following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Client programs can then be written [...]
|
||
Between v1 and v2, dex switched from REST to gRPC. This largely stemmed from problems generating documentation, client bindings, and server frameworks that adequately expressed REST semantics. While [Google APIs][google-apis], [Open API/Swagger][open-api], and [gRPC Gateway][grpc-gateway] were evaluated, they often became clunky when trying to use specific HTTP error codes or complex request bodies. As a result, v2's API is entirely gRPC. | ||
|
||
Many of arguments _against_ gRPC cite short term convenience rather than production use cases. Though this is a recognized shortcoming, dex already implements many features for developer convenience. For instance, users who wish to manually edit clients during testing can use the `staticClients` config field instead of the API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many arguments against (get rid of of
).
eb02cb1
to
fe1d275
Compare
changes addressed. thanks |
No description provided.