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

[Fleet] Improve OpenAPI accuracy and validity #105679

Merged
merged 10 commits into from
Jul 15, 2021

Conversation

jfsiii
Copy link
Contributor

@jfsiii jfsiii commented Jul 14, 2021

Summary

OpenAPI spec now validates (no errors. only some debatable warnings). Perhaps easier to read as individual commits

  • Added responses for the operations which didn't define any. Now each operation has at least one response defined
  • Improved the accuracy of several responses by replacing a blank object with a reference to a schema
  • Removed definition for a route that no longer exists (route 404's in master)

Validation

  1. apitools.dev

  2. npx @redocly/openapi-cli lint entrypoint.yaml
    npx @redocly/openapi-cli lint entrypoint.yaml
    npx: installed 88 in 15.573s
    No configurations were defined in extends -- using built in recommended configuration by default.
    
    validating entrypoint.yaml...
    entrypoint.yaml: validated in 377ms
    
    Woohoo! Your OpenAPI definition is valid. 🎉

Doc viewer choices

  1. redocly
  2. swagger.io
  3. MrinDoc

redocly example
Screen Shot 2021-07-14 at 4 45 38 PM

Checklist

  • Documentation was added for features that require explanation or tutorials

@jfsiii jfsiii added v8.0.0 Team:Fleet Team label for Observability Data Collection Fleet team v7.14.0 labels Jul 14, 2021
@jfsiii jfsiii self-assigned this Jul 14, 2021
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 516 515 -1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1037 1035 -2

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 448.3KB 447.9KB -387.0B
Unknown metric groups

API count

id before after diff
fleet 1132 1130 -2

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

cc @jfsiii

@jfsiii jfsiii marked this pull request as ready for review July 15, 2021 10:21
@jfsiii jfsiii requested a review from a team as a code owner July 15, 2021 10:21
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jfsiii jfsiii added release_note:skip Skip the PR/issue when compiling release notes auto-backport Deprecated - use backport:version if exact versions are needed labels Jul 15, 2021
@jfsiii jfsiii enabled auto-merge (squash) July 15, 2021 12:41
Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Looks great. Thank you for all the work here! 🚀

@jfsiii jfsiii merged commit 00cee5f into elastic:master Jul 15, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2021
* Improve schema from object to $ref

* Add description and response schema for /agent-status endpoint

* Remove code related to removed /install/:os endpoint

* Add response schemas for enrollment-api-key operations

* Add response schemas for /agents/:agentId

* Fix two security scheme names

* Change format for reference selectors

* Replace Ingest Manager with Fleet in OpenAPI spec

* Replace instances of Ingest Manager with Fleet

* Update instructions to create bundled specs
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.14

This backport PR will be merged automatically after passing CI.

@jen-huang jen-huang added v7.15.0 auto-backport Deprecated - use backport:version if exact versions are needed and removed auto-backport Deprecated - use backport:version if exact versions are needed labels Jul 15, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2021
* Improve schema from object to $ref

* Add description and response schema for /agent-status endpoint

* Remove code related to removed /install/:os endpoint

* Add response schemas for enrollment-api-key operations

* Add response schemas for /agents/:agentId

* Fix two security scheme names

* Change format for reference selectors

* Replace Ingest Manager with Fleet in OpenAPI spec

* Replace instances of Ingest Manager with Fleet

* Update instructions to create bundled specs
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Jul 15, 2021
* Improve schema from object to $ref

* Add description and response schema for /agent-status endpoint

* Remove code related to removed /install/:os endpoint

* Add response schemas for enrollment-api-key operations

* Add response schemas for /agents/:agentId

* Fix two security scheme names

* Change format for reference selectors

* Replace Ingest Manager with Fleet in OpenAPI spec

* Replace instances of Ingest Manager with Fleet

* Update instructions to create bundled specs

Co-authored-by: John Schulz <john.schulz@elastic.co>
kibanamachine added a commit that referenced this pull request Jul 15, 2021
* Improve schema from object to $ref

* Add description and response schema for /agent-status endpoint

* Remove code related to removed /install/:os endpoint

* Add response schemas for enrollment-api-key operations

* Add response schemas for /agents/:agentId

* Fix two security scheme names

* Change format for reference selectors

* Replace Ingest Manager with Fleet in OpenAPI spec

* Replace instances of Ingest Manager with Fleet

* Update instructions to create bundled specs

Co-authored-by: John Schulz <john.schulz@elastic.co>
jfsiii pushed a commit that referenced this pull request Jul 15, 2021
Fix the typo in #105679 which indicates `/agents` returns a list of agent policy objects instead of the correct list of agents.

diff from `/paths/agents.yaml`
```diff
-                  $ref: ../components/schemas/agent_policy.yaml
+                  $ref: ../components/schemas/agent.yaml
```

<details><summary>screenshot - before</summary>
<img width="1293" alt="Screen Shot 2021-07-15 at 12 39 14 PM" src="https://user-images.githubusercontent.com/57655/125829619-ddbd74f4-8806-45c4-af94-4b7645e2dc9b.png">
</details>

<details><summary>screenshot - after</summary>
<img width="1302" alt="Screen Shot 2021-07-15 at 12 39 33 PM" src="https://user-images.githubusercontent.com/57655/125829622-2715d071-14ee-4a2d-9ff5-96ece4eea682.png">
</details>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2021
Fix the typo in elastic#105679 which indicates `/agents` returns a list of agent policy objects instead of the correct list of agents.

diff from `/paths/agents.yaml`
```diff
-                  $ref: ../components/schemas/agent_policy.yaml
+                  $ref: ../components/schemas/agent.yaml
```

<details><summary>screenshot - before</summary>
<img width="1293" alt="Screen Shot 2021-07-15 at 12 39 14 PM" src="https://user-images.githubusercontent.com/57655/125829619-ddbd74f4-8806-45c4-af94-4b7645e2dc9b.png">
</details>

<details><summary>screenshot - after</summary>
<img width="1302" alt="Screen Shot 2021-07-15 at 12 39 33 PM" src="https://user-images.githubusercontent.com/57655/125829622-2715d071-14ee-4a2d-9ff5-96ece4eea682.png">
</details>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2021
Fix the typo in elastic#105679 which indicates `/agents` returns a list of agent policy objects instead of the correct list of agents.

diff from `/paths/agents.yaml`
```diff
-                  $ref: ../components/schemas/agent_policy.yaml
+                  $ref: ../components/schemas/agent.yaml
```

<details><summary>screenshot - before</summary>
<img width="1293" alt="Screen Shot 2021-07-15 at 12 39 14 PM" src="https://user-images.githubusercontent.com/57655/125829619-ddbd74f4-8806-45c4-af94-4b7645e2dc9b.png">
</details>

<details><summary>screenshot - after</summary>
<img width="1302" alt="Screen Shot 2021-07-15 at 12 39 33 PM" src="https://user-images.githubusercontent.com/57655/125829622-2715d071-14ee-4a2d-9ff5-96ece4eea682.png">
</details>
kibanamachine added a commit that referenced this pull request Jul 15, 2021
Fix the typo in #105679 which indicates `/agents` returns a list of agent policy objects instead of the correct list of agents.

diff from `/paths/agents.yaml`
```diff
-                  $ref: ../components/schemas/agent_policy.yaml
+                  $ref: ../components/schemas/agent.yaml
```

<details><summary>screenshot - before</summary>
<img width="1293" alt="Screen Shot 2021-07-15 at 12 39 14 PM" src="https://user-images.githubusercontent.com/57655/125829619-ddbd74f4-8806-45c4-af94-4b7645e2dc9b.png">
</details>

<details><summary>screenshot - after</summary>
<img width="1302" alt="Screen Shot 2021-07-15 at 12 39 33 PM" src="https://user-images.githubusercontent.com/57655/125829622-2715d071-14ee-4a2d-9ff5-96ece4eea682.png">
</details>

Co-authored-by: John Schulz <john.schulz@elastic.co>
kibanamachine added a commit that referenced this pull request Jul 15, 2021
Fix the typo in #105679 which indicates `/agents` returns a list of agent policy objects instead of the correct list of agents.

diff from `/paths/agents.yaml`
```diff
-                  $ref: ../components/schemas/agent_policy.yaml
+                  $ref: ../components/schemas/agent.yaml
```

<details><summary>screenshot - before</summary>
<img width="1293" alt="Screen Shot 2021-07-15 at 12 39 14 PM" src="https://user-images.githubusercontent.com/57655/125829619-ddbd74f4-8806-45c4-af94-4b7645e2dc9b.png">
</details>

<details><summary>screenshot - after</summary>
<img width="1302" alt="Screen Shot 2021-07-15 at 12 39 33 PM" src="https://user-images.githubusercontent.com/57655/125829622-2715d071-14ee-4a2d-9ff5-96ece4eea682.png">
</details>

Co-authored-by: John Schulz <john.schulz@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.14.0 v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants