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

Documentation: add document on the dex API #652

Merged
merged 1 commit into from
Nov 1, 2016

Conversation

ericchiang
Copy link
Contributor

No description provided.

@ericchiang ericchiang force-pushed the dev-docs-api branch 2 times, most recently from 08b1cd0 to cf79f10 Compare October 31, 2016 03:52
@ericchiang ericchiang changed the title Documentation: add document on API Documentation: add document on the dex API Oct 31, 2016
@ericchiang
Copy link
Contributor Author

@ElijahCaine ptal

Copy link
Contributor

@pop pop left a 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.
Copy link
Contributor

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.
Copy link
Contributor

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:
Copy link
Contributor

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.
Copy link
Contributor

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).

@ericchiang
Copy link
Contributor Author

changes addressed. thanks

@ericchiang ericchiang merged commit 1c51c50 into dexidp:dev Nov 1, 2016
@ericchiang ericchiang mentioned this pull request Nov 9, 2016
@ericchiang ericchiang deleted the dev-docs-api branch November 22, 2016 20:07
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

Successfully merging this pull request may close these issues.

None yet

2 participants