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

Wiki missing an example of Kind: Spec #1233

Open
stokedout opened this issue Oct 18, 2023 · 3 comments
Open

Wiki missing an example of Kind: Spec #1233

stokedout opened this issue Oct 18, 2023 · 3 comments

Comments

@stokedout
Copy link
Contributor

stokedout commented Oct 18, 2023

Hey, regarding specs, it says that specs shouldn't be inlined but there's no reference example of how a Spec should be formatted. it would be good to have a copy-paste example of the Spec kind just like the others on this wiki page as a reference. Would it be possible to get one?

To import them with Registry YAML, registry apply uses the filename field of specs to identify the files to upload and it looks for these files in the same directory where the referring YAML file is found.

File or files? Would you be able to provide an exhaustive list of inputs for filename?

mimeType on Spec seems optional, what is it needed for?

@timburks
Copy link
Contributor

Hi, yes, we can add an example spec. The registry is format-agnostic, so specs could be any version of OpenAPI or any other single-file format and we have been uploading multifile specs (such as collections of .proto) files as zip archives.

I'll also try to clarify that language -- we're assuming that even multifile specs like protos get put into an archive, and there the filename would be the filename of the archive. If the archive doesn't exist, registry apply creates it by zipping up everything in the same directory as the info.yaml file that describes the spec.

mimeType is optional but strongly needed by downstream tools (linters, code generators, etc). We're currently uploading API specs as blobs and not trying to internally identify their types (possibly a project for the future).

@timburks
Copy link
Contributor

Here is an example of a proto-style API description (in info.yaml) and a corresponding set of protos that get zipped up and uploaded by registry apply. If you clone this repo, you can just run registry apply -f apis -R at the root of the repo to try this yourself.

Here is an example of an API with two OpenAPI descriptions (one in the older Swagger/OpenAPI 2.0 format and one in OpenAPI 3.0). Both specs are uploaded when you run registry apply -f apis -R at the root of this repo (note that it's different from the one above).

@timburks timburks reopened this Oct 18, 2023
@timburks
Copy link
Contributor

(keeping this open until the wiki is updated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants