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

[OAS] Add saved objects openAPI folder #162522

Merged
merged 11 commits into from
Aug 16, 2023
Merged

Conversation

lcawl
Copy link
Contributor

@lcawl lcawl commented Jul 25, 2023

Summary

Relates to #137240

This PR drafts openAPI specifications for import objects and export objects

The assumption is that as we determine how/if the specifications differ for Serverless, we can create a entrypoint-serverless.yaml file and re-use as much content as possible.

@lcawl lcawl added Team:Docs Feature:Saved Objects release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting docs labels Jul 25, 2023
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@lcawl lcawl requested a review from lukeelmers August 4, 2023 21:56
@lcawl lcawl marked this pull request as ready for review August 4, 2023 21:56
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-docs (Team:Docs)

@lcawl lcawl requested a review from a team August 8, 2023 14:58
@lcawl lcawl added release_note:enhancement and removed release_note:skip Skip the PR/issue when compiling release notes labels Aug 9, 2023
Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

Generally looks ok w.r.t actual API definitions.
I have a few comments and suggestions that don't necessarily need to be addressed now if the PR is urgent.
Please do take note of them though.

The current self-contained spec file is `bundled.json` or `bundled.yaml` and can be used for online tools like those found at <https://openapi.tools/>.
This spec is experimental and may be incomplete or change later.

A guide about the openApi specification can be found at [https://swagger.io/docs/specification/about/](https://swagger.io/docs/specification/about/).
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK, every api that has an openApi spec will have a README. That's a lot of duplication and adds to the bundle size. The original intent of moving kibana to packages was to keep Kibana small (codes size wise) and fast.

For now, it's probably ok but we need to watch that. @elastic/kibana-operations are we at all concerned about bundle size increasing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, if there are any space savings that can occur that's worth doing. Once we get to the point where the specs are being generated from the code there will hopefully be a lot less overhead too.

Copy link
Member

Choose a reason for hiding this comment

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

We can keep an eye on it, thanks for the heads up. We're removing most documentation from the distribution currently, unless it's referenced in kibana itself.

Then you can generate the `bundled` files by running the following commands:

```bash
npx @redocly/cli bundle entrypoint.yaml --output bundled.yaml --ext yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't work as written.

e.g. locally, I get:

Error opening file "/Users/christianeheiligers/Projects/kibana/entrypoint.yaml"
ENOENT: no such file or directory, open '/Users/christianeheiligers/Projects/kibana/entrypoint.yaml'

If we're going to stick with a README in every package, we need working code snippets.

This works:

npx swagger-cli validate entrypoint.yamlackages/core/saved-objects/docs/openapi/entrypoint.yaml

How is bundling supposed to work?
The code snippet creates a bundle locally at the root level of Kibana code. Won't that be replaced every time a new bundle get's created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, in other API readmes I mentioned that you have to run those from the directory where these specs are located. I'll update that.

@lcawl lcawl enabled auto-merge (squash) August 16, 2023 21:45
@lcawl lcawl merged commit 8ce5177 into elastic:main Aug 16, 2023
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@lcawl lcawl deleted the saved-objects-oas1 branch August 25, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants