Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] use @kbn/config-schema in Fleet API (Part 1) (elastic#192447)
## Summary Part of elastic#184685 First set of changes, I'm planning to do more prs for the remaining endpoints. Will also look at making sure these schema definitions are included in the final kibana `bundle.json`, related doc: https://elasticco.atlassian.net/wiki/spaces/DOC/pages/450494532/API+reference+docs When all schema definitions are moved to code, the fleet/openapi folder can be deleted. To check the result, add to `kibana.dev.yml`: `server.oas.enabled: true` And then in kibana console, query: ``` GET kbn:/api/oas?pathStartsWith=/api/fleet/setup GET kbn:/api/oas?pathStartsWith=/api/fleet/agents/setup GET kbn:/api/oas?pathStartsWith=/api/fleet/package_policies GET kbn:/api/oas?pathStartsWith=/api/fleet/package_policies/delete GET kbn:/api/oas?pathStartsWith=/api/fleet/settings GET kbn:/api/oas?pathStartsWith=/internal/fleet/settings/enrollment ``` To generate the bundle from code, run: ``` node scripts/capture_oas_snapshot --include-path /api/fleet --no-serverless --update # writes to oas_docs/bundle.json ``` Response: ``` { "openapi": "3.0.0", "info": { "title": "Kibana HTTP APIs", "version": "0.0.0" }, "servers": [ { "url": "http://localhost:5603/julia" } ], "paths": { "/api/fleet/setup": { "post": { "summary": "", "tags": [], "description": "Initiate Fleet setup", "responses": { "200": { "content": { "application/json; Elastic-Api-Version=2023-10-31": { "schema": { "type": "object", "description": "A summary of the result of Fleet's `setup` lifecycle. If `isInitialized` is true, Fleet is ready to accept agent enrollment. `nonFatalErrors` may include useful insight into non-blocking issues with Fleet setup.", "properties": { "isInitialized": { "type": "boolean" }, "nonFatalErrors": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "message": { "type": "string" } }, "additionalProperties": false, "required": [ "name", "message" ] } } }, "additionalProperties": false, "required": [ "isInitialized", "nonFatalErrors" ] } } } }, "400": { "content": { "application/json; Elastic-Api-Version=2023-10-31": { "schema": { "type": "object", "description": "Generic Error", "properties": { "statusCode": { "type": "number" }, "error": { "type": "string" }, "message": { "type": "string" } }, "additionalProperties": false, "required": [ "statusCode", "error", "message" ] } } } }, "500": { "content": { "application/json; Elastic-Api-Version=2023-10-31": { "schema": { "type": "object", "description": "Internal Server Error", "properties": { "message": { "type": "string" } }, "additionalProperties": false, "required": [ "message" ] } } } } }, "parameters": [ { "in": "header", "name": "elastic-api-version", "description": "The version of the API to use", "schema": { "type": "string", "enum": [ "2023-10-31" ], "default": "2023-10-31" } }, { "description": "A required header to protect against CSRF attacks", "in": "header", "name": "kbn-xsrf", "required": true, "schema": { "example": "true", "type": "string" } } ], "operationId": "%2Fapi%2Ffleet%2Fsetup#0" } } }, "components": { "schemas": {}, "securitySchemes": { "basicAuth": { "type": "http", "scheme": "basic" }, "apiKeyAuth": { "type": "apiKey", "in": "header", "name": "Authorization" } } }, "security": [ { "basicAuth": [] } ], "tags": [] } ```
- Loading branch information