Skip to content

Conversation

@TristanSpeakEasy
Copy link
Member

@TristanSpeakEasy TristanSpeakEasy commented Jun 2, 2023

Please feel free to use the suggestion feature of Github and provide suggestions for changes to the content here.

Also seeking early feedback for structure and specific information I should be calling out in regards to our product.

My early pass on this will likely be mirroring the official spec mostly before I do a second pass and try to add similar additional information to the swagger docs

This is not intended to be the final format of the documentation (We will likely have a much more complex MDX or even better formatted website with lots of interactivity I would imagine), this is just meant to be an initial structure and creation of content for our own OpenAPI documentation.

VIEW THE ACTUAL DOCUMENTATION HERE: https://github.com/speakeasy-api/openapi-reference-documentation/blob/initial-draft/README.md

@TristanSpeakEasy TristanSpeakEasy marked this pull request as draft June 2, 2023 17:18
Copy link

@zostay zostay left a comment

Choose a reason for hiding this comment

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

I enjoy your writing here. It's not too formal and not too conversational. The tone is very even and doesn't feel foreign (as writing by folks across either pond sometimes do). It is easy to follow what your saying and you convey that what you're saying is interesting and important to you.

I'd like to see the introduction lay out what the document is attempting to accomplish and it's philosophy. This will probably change as you write and doesn't need to be present at this point in the writing, but I find it helpful when the author(s) of orient my expectations and help me understand why they felt a need to write the document and what they hope to accomplish that sets it apart. It is also helpful to layout a thesis that describes how the document is laid out to set the expectation as to the structure of the document and how each section will generally work, etc.

From the name of the repo, I expect this document to be reference documentation, but the intro feels more like a guide. That expectation could be aided with a thesis/summary section as I've mentioned above. When I'm learning a new tech, I usually like to start with some sort of guide, which is mostly prose, typically with embedded tutorials and examples. Then, as I become familiar with it, I move over the reference, often not finishing the guide (I'm in a hurry and I'm a slow reader), and just refer to that from there on. Sometimes, documents attempt to be a little of both, which can also work. Anyway, some of my commentary is based on not yet knowing what your intensions are as the document is still in a very early drafty form.

Your writing is, except where I've noted, very readable and doesn't feel formal to me. It leans a little heavily into tables and code at this point, but that's what you'd expect from a reference, so I don't know that that's actually a criticism or just me wanting something with more guidance and less reference at this point.

This is an excellent start. I look forward to reviewing it further as you make progress over the next few weeks.

### How does this documentation differ from the official OpenAPI documentation?

`TODO`

Copy link

Choose a reason for hiding this comment

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

I think it would be useful to have a section between Introduction and The Document that covers the needs of APIs in general. We don't have to be too basic, but use it as a way to introduce and define the jargon we're going to use in this document and also provide a general notion of what an API needs some kind of specification at all. This can also be an opportunity to discuss the difference between an APIs as an abstract construct, the implementation of it on the server, and the client SDKs used to access it. No more board than necessary to carry the rest of the document forward, but broad enough to cover what we care about at Speakeasy and to understand how OpenAPI works in the abstract.

This could also be a good place to introduce the API we're going to be using in the examples and use that to make the abstract description of APIs into a concrete idea:. For example, you could describe a particular API endpoint and it's purpose is, show how it would be implemented on the server side in Python, and then a basic handwritten SDK client caller of some kind, maybe using JavaScript.

Anyway, something more general, but still with some concrete bits to keep it grounded might be a good place to introduce topics and jargon the reader will need to understand later and may or may not have experienced before, depending on their experience level with APIs.

Copy link
Member Author

@TristanSpeakEasy TristanSpeakEasy Jun 13, 2023

Choose a reason for hiding this comment

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

Yep great idea and I totally agree, @ndimares I think you might be better placed to write
something like that for this, but if not I will definitely get round to it


```yaml
servers:
- url: https://{organization}.{environment}.speakeasy.bar
Copy link

Choose a reason for hiding this comment

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

Ideally, we ought to own speakeasy.bar or whatever we use as the domain name in the examples. It would be best if there was an actual API at the host location that actually worked at that location. Otherwise, we should stick to example.com for references. According to my usual domain registrar, and to my astonishment, this domain appears to be available for $409 with a $585 renewal.

Copy link
Member Author

Choose a reason for hiding this comment

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

@simplesagar can we do that? Buy https://speakeasy.bar and then yeah I think it would be pretty cool to host a usable API there that is just a mock for matching the document, will just need to be a bit more careful in making sure the examples are actually reflective of real world usage

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe @simplesagar has now purchased this?

sdk.sdkConfiguration.ServerIndex = serverIndex
}
}
```
Copy link

Choose a reason for hiding this comment

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

It might be better to select a language like Python for the codegen examples as it has a wider adoption and is generally more familiar to people than Golang.

Copy link
Member Author

Choose a reason for hiding this comment

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

So I just did Golang for now as I can write it really easily without too much back and forward reference checking, but what I would eventually like to see is us having tabs for each language we support and examples in all the languages

speakeasy.WithEnvironment(speakeasy.ServerEnvironmentStaging),
speakeasy.WithOrganization("speakeasy"),
)
```
Copy link

Choose a reason for hiding this comment

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

This is a long enough Speakeasy tip that I almost feel a blog post would be a good idea and just link off to that or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

So the SDK Generation examples will largely be "pop out" example ie they will be hidden behind an accordion expansion section or similar and are only shown when the user clicks on them, so the intent is not to have them inline like this

Copy link
Member Author

Choose a reason for hiding this comment

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

But there could also be an argument for two (or more) different documents that just link back and forward to one another.

Information/documentation structure is something we should definitely discuss and get maybe some feedback on from a design agency etc.

For now the purpose of this is to largely write the content so it is then available for us to build our perfect OpenAPI documentation from.


The above example requires both an API Key **AND** Basic Auth to be provided.

This **AND**/**OR** logic along with optional (`{}`) security can be used in any combination to express complex authorization scenarios.
Copy link

Choose a reason for hiding this comment

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

What if I have an API where a handful of the endpoints require no security, but the rest require some security?

For example, perhaps I provide an auth endpoint that generates a security token from some other shared secret or passkey or something that must be passed to the other endpoints.

How would that situation be handled?

I feel like this document is going to require a large security section with examples of the four or five most common cases because security is so fundamental to APIs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added more examples let me know what you think

@TristanSpeakEasy
Copy link
Member Author

TristanSpeakEasy commented Jun 13, 2023

From the name of the repo, I expect this document to be reference documentation, but the intro feels more like a guide

So the main purpose of this document is to be reference documentation but I wanted to include enough concrete examples and explanations that the reader leaves with a good understanding of how things work. In my eyes the main problem with the official documentation is it is too light on concrete details and then the swagger documentation is the opposite it doesn't have enough reference documentation, so I want ours to straddle the line of balance between both.

### What is OpenAPI and why use it?

`TODO`
Copy link
Member Author

Choose a reason for hiding this comment

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

@ndimares help would be appreciated on the content for this section

### How does this documentation differ from the official OpenAPI documentation?

`TODO`
Copy link
Member Author

Choose a reason for hiding this comment

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

@ndimares help would be appreciated on the content for this section

sixhobbits added a commit that referenced this pull request Jan 31, 2024
WIP Add to OpenAPI document, add validation, some writing
@ndimares ndimares marked this pull request as ready for review March 1, 2024 14:58
@ndimares ndimares merged commit 20c6e2a into main Mar 1, 2024
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.

4 participants