Commit graph

30 commits

Author SHA1 Message Date
Ying Mao
a6c4120b35
[Response Ops][Alerting] Adding new value to warning reasons enum schema in rule saved object (#190743)
## Summary

We want to allow rule executors to report warnings back to the framework
and have them show up in the stack management UI. We currently have a
mechanism for this that is used by detection rules but they handle how
to show the warning in their custom UI so the warning does not appear in
the stack management UI. This PR adds a new value to the allow list of
"warning reasons". This should not warrant a schema version bump because
it is a new value for an existing enum but we need to do an intermediate
release so the new schema is recognized before we start setting it
anywhere. This PR is just for schema changes. PR that uses these schema
changes can be found here: https://github.com/elastic/kibana/pull/189312

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-21 10:17:29 -04:00
Lisa Cawley
e429b73e5a
[OAS][DOCS] Use automated alerting rule API documentation (#190205)
Co-authored-by: Jean-Louis Leysens <jeanlouis.leysens@elastic.co>
2024-08-15 17:07:56 -05:00
Lisa Cawley
444b8d010e
[DOCS][OAS] Add Fleet APIs (#190571) 2024-08-15 12:49:58 -05:00
Lisa Cawley
4ceb3e4f31
[DOCS][OAS] Re-add case APIs (#190573) 2024-08-15 09:15:49 -07:00
Lisa Cawley
1144c0cea7
[OAS][DOCS] Temporarily omit security APIs from docs (#190467) 2024-08-14 11:52:18 -05:00
Lisa Cawley
286e0e0a9f
[OAS][DOCS] Edit linting rule severity (#190470) 2024-08-14 10:15:29 -05:00
Jonathan Budzenski
a9c4d2fa34 Revert "[OAS] Include alerting rule APIs (#189962)"
This reverts commit b85b1cb506.
2024-08-13 12:25:03 -05:00
Jean-Louis Leysens
b85b1cb506
[OAS] Include alerting rule APIs (#189962)
## Summary

Includes alerting rule APIs in our OAS snapshots.

## How to test

Using bump CLI you can preview the output:

```sh
bump preview ./oas_docs/bundle.json
# or
bump preview ./oas_docs/bundle.serverless.json
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-13 17:21:10 +02:00
Maxim Palenov
7a2e7bef96
[HTTP/OAS] Merge OpenAPI specs by using kbn-openapi-bundler (#189262)
**Addresses:** https://github.com/elastic/kibana/issues/186356
**Relates to:** https://github.com/elastic/kibana/issues/184428

## Summary

This PR adds a merging JS script based on the utility implemented in https://github.com/elastic/kibana/issues/186356. Resulted OpenAPI bundle as committed in `oas_docs/output/kibana.serverless.bundled.yaml`.

## Details

https://github.com/elastic/kibana/pull/188110 implements and exposes `merge` utility design to merge source OpenAPI specs without processing. It's has only a programmatic API. To merge OpenAPI specs it's required to add a JS script like below

```js
const { merge } = require('@kbn/openapi-bundler');

(async () => {
  await merge({
   sourceGlobs: [/* a list of source globs goes here */],
   outputFilePath: 'path/to/the/output/file.yaml',
  });
})();
```

The JS script added in this PR includes source OpenAPI specs presented in `oas_docs/makefile` plus Security Solution OpenAPI specs based on https://github.com/elastic/kibana/issues/184428.

**To run** the script use the following command from Kibana root folder

```bash
node ./oas_docs/scripts/merge_serverless_oas.js 
```

## Known linting issues with Security Solution OpenAPI specs

Running Spectral OpenAPI linter on the result bundle shows a number of errors caused by `no-$ref-siblings` rule. This caused by the current code generator implementation which requires `default` property to be set next to `$ref` though it's not correct for OpenAPI `3.0.3` while it's allowed in `3.1`. It seems that Bump.sh handles such cases properly though by properly showing a default value.

We need to analyze the problem and decide if/when we should fix it.

The rest of warnings look fixable and will be addressed in the next stage after setting up linter rules.

## Next steps

Since `@kbn/openapi-bundler` package is tailored specifically for Kibana it should replace Redocly currently used to merge OpenAPI specs. It also means `oas_docs/makefile` should be superseded by JS script(s) using `merge` utility form `@kbn/openapi-bundler` package.

`@kbn/openapi-bundler` SHOULD NOT replace OpenAPI linters since it doesn't perform thorough linting. It's good if we continue adopting `spectral-cli` for linting purposes.
2024-08-13 12:45:35 +02:00
Lisa Cawley
d323898483
[OAS][DOCS] Add tag x-displayName in overlays (#189842) 2024-08-06 11:13:31 -07:00
Lisa Cawley
176a2210d7
[OAS][DOCS] Add temporary overlays for Kibana API documents (#189322) 2024-08-01 09:38:01 -07:00
Lisa Cawley
e4a0658225
[OAS][DOCS] Deprecate saved object APIs (#189223) 2024-07-30 21:38:04 -05:00
Lisa Cawley
8a26557491
[DOCS][OAS] Add alerting to Kibana API bundle (#188885) 2024-07-30 17:59:47 -05:00
Lisa Cawley
d86e139343
[DOCS][OAS] Add cases to Kibana API bundle (#189020) 2024-07-30 07:48:04 -07:00
Lisa Cawley
102a42ca4e
[OAS][DOCS] Remove some SLO APIs from OpenAPI documents (#189323) 2024-07-29 13:50:16 -05:00
Lisa Cawley
841e95c64b
[OAS][ML] Add sync API tags and description, minor OpenAPI fixes (#189230) 2024-07-26 15:28:43 -05:00
Lisa Cawley
e6795e5b0a
[DOCS][OAS] Add descriptions, tags, deprecation to connector APIs (#184956) 2024-07-25 16:46:30 -05:00
Lisa Cawley
42c5d918d3
[OAS][DOCS] Add x-topics info about running APIs in spaces (#189144) 2024-07-25 13:23:52 -05:00
Lisa Cawley
8dc286067b
[DOCS][OAS] Add data view swap saved object references and preview APIs (#187927) 2024-07-24 17:31:06 -05:00
Lisa Cawley
17181e6ba5
[OAS] Combine manual and automated OpenAPI documents (#188702) 2024-07-22 16:20:03 -05:00
Jean-Louis Leysens
a8091ab0ac
[OAS/HTTP] Empty response bodies (status only) and descriptions for responses (#188632)
## Summary

* Adds the ability to exclude a response schema when declaring route
schemas
* Adds the ability to provide a description of a the response

See code comments for more info.

## Example

You can declare a response with no validation to imply an empty object
in OAS

```
router.versioned.post({ version: '2023-10-31', access: 'public', path: '...' })
  .addVersion({
    validation: {
      responses: {
        201: { description: 'Resource created!' }
      }
    }
  }, () => {})
```

Will result in

```jsonc
{
 //...
  201: { description: 'Resource created!' }
 //...
}
```

## Risks

No notable risks
2024-07-22 15:29:15 +02:00
Lisa Cawley
15401de051
[OAS] Generate OpenAPI document for Kibana APIs (#188613) 2024-07-19 07:26:40 +10:00
Lisa Cawley
f4f936fe4a
[OAS] Refresh Kibana serverless APIs (#186853) 2024-07-19 02:20:48 +10:00
Jean-Louis Leysens
46a457e0cc
[OAS] Better support for enums (#188198)
Close https://github.com/elastic/kibana/issues/182658
2024-07-16 10:49:48 +01:00
Lisa Cawley
cd96a10529
[DOCS] Add SLO APIs to bundled OpenAPI document (#186575) 2024-06-20 19:49:05 -07:00
Lisa Cawley
bdef3aed2b
[HTTP/OAS] Add makefile to oas_docs (#185911) 2024-06-19 08:57:00 -07:00
Jean-Louis Leysens
cf7196fa1f
[OAS] Capture and commit serverless bundle (#184915)
## Summary

Close https://github.com/elastic/kibana/issues/184719

Adds the ability to capture OAS for `serverless` build flavor in
addition to `traditional`. By default the CLI will run for both, but
this can be controlled by passing in one of two new flags:
`--no-serverless` or `--no-traditional`.

See `oas_docs/bundle.serverless.json` for output.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-06-10 03:48:10 -07:00
Jean-Louis Leysens
dd1864b876
[OAS] Refactor description -> summary (#184651)
## Summary

Per [the OAS docs](https://swagger.io/specification/), they have an info
object with a `summary` and `description` field. This PR refactors the
existing router `description` field to to OAS `summary` (that is how it
has been used) and introduces a "new" `description` field that will be
used for the longer form descriptions.

## Resources
* https://swagger.io/specification/

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
2024-06-06 06:49:41 -07:00
Jean-Louis Leysens
5fd4795b77
[OAS] Support tags (#184320) 2024-06-04 17:45:12 +02:00
Jean-Louis Leysens
975eeed255
[HTTP/OAS] Commit OAS snapshot (#183338)
Close https://github.com/elastic/kibana/issues/181992

## Summary

First iteration of a CLI to capture an OAS snapshot.

## How to test

Run `node ./scripts/capture_oas_snapshot.js --update --include-path
/api/status` and see result in `oas_docs/bundle.json`.

If you have the [bump CLI](https://www.npmjs.com/package/bump-cli)
installed you can preview the hosted output with `bump preview
./oas_docs/bundle.json`

## Notes
* Added ability to filter by `version`, `access` (public/internal) and
excluding paths explicitly to the OAS generation lib
* Follows the same general pattern as our other "capture" CLIs like
`packages/kbn-check-mappings-update-cli`
* Result includes only `/api/status` for now, waiting for other paths to
add missing parts

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-30 06:02:19 -07:00