kibana/dev_docs/tutorials
Jean-Louis Leysens 5e90e557cf
[OAS] Support examples (and more) (#212495)
## Summary

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

Adds the ability to merge in an arbitrary OAS operation object (search
[spec](https://swagger.io/specification/) for "operation object") in
code generated OAS.

This enables us to write examples next to the code:

<img width="306" alt="Screenshot 2025-02-26 at 11 24 00"
src="https://github.com/user-attachments/assets/5df92ae9-c8c5-4797-8b7c-764e937e84e9"
/>

```ts
// Inside the router declaration
  router.post(
    {
      path: `${BASE_ALERTING_API_PATH}/rule/{id?}`,
      security: DEFAULT_ALERTING_ROUTE_SECURITY,
      options: {
        access: 'public',
        summary: `Create a rule`,
        tags: ['oas-tag:alerting'],
        // NEW 👇🏻: this file can contain operation-level OAS and will merge/override anything that we auto generate
        oasOperationObject: () => path.join(__dirname, 'create_rule.examples.yaml'),
        // ☝🏻 can also be a TS-checked OpenAPIV3.OperationObject
```

Tested with create rule example overlay
([gist](https://gist.github.com/jloleysens/dc643522a3f58dc2aed3dcef966b42df))
and bump

<img width="1236" alt="Screenshot 2025-02-26 at 11 45 57"
src="https://github.com/user-attachments/assets/c21b466a-ddab-49ce-b4ba-a04fd0e6c1b7"
/>

## Docs

Added developer guide docs to
https://docs.elastic.dev/kibana-dev-docs/genereating-oas-for-http-apis#2-route-definitions

<details>

<summary>images</summary>

<img width="799" alt="Screenshot 2025-03-13 at 13 02 31"
src="https://github.com/user-attachments/assets/e89b2c5a-1984-4672-a40b-b492581e690f"
/>

<img width="819" alt="Screenshot 2025-03-13 at 13 02 39"
src="https://github.com/user-attachments/assets/1375a25a-4d91-46b4-8ce5-42c763657d96"
/>

</details>




### TO DO
- [x] Document the feature in TS
- [x] Document feature in dev docs
- [x] Add tests

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-14 14:56:28 +01:00
..
data SKA: Update broken references and URLs (#206836) 2025-01-28 03:32:48 +00:00
performance SKA: Relocate "platform" packages that remain on /packages (#208704) 2025-02-24 11:03:30 +00:00
screenshotting [Screenshotting] Organize dev docs for screenshotting/chromium (#198100) 2024-10-30 11:55:12 -05:00
advanced_settings.mdx [Advanced settings] Update migration guidance in advanced settings tutorial (#208010) 2025-01-29 14:42:29 +01:00
apm_ui.png Debugging with apm - fixes and tutorial (#127892) 2022-03-22 14:56:37 +02:00
building_a_kibana_distributable.mdx [api-docs] follow the correct schema for frontmatter (#138348) 2022-08-10 17:17:50 -05:00
ci.mdx [build] Add Docker images with FIPS (#175946) 2024-02-07 12:09:52 -08:00
configuring_cross_cluster_search.mdx [dev docs] How to set up cross cluster search locally (#182025) 2024-04-30 12:46:21 -05:00
data_views.mdx [api-docs] follow the correct schema for frontmatter (#138348) 2022-08-10 17:17:50 -05:00
debugging.mdx [Dev Docs] Add VS Code configurations to Dev Docs Debugging Tutorial (#212807) 2025-03-06 10:14:19 -05:00
debugging_fips_test_failures.mdx SKA: Relocate "platform" packages that remain on /packages (#208704) 2025-02-24 11:03:30 +00:00
development_windows.mdx [api-docs] follow the correct schema for frontmatter (#138348) 2022-08-10 17:17:50 -05:00
endpoints.mdx Deprecated authRequired in favor of security.authc.enabled (#202414) 2024-12-10 11:24:41 +01:00
expressions.mdx [api-docs] follow the correct schema for frontmatter (#138348) 2022-08-10 17:17:50 -05:00
fips_test_failure_license_override_example.png Adding documentation to aid team in triaging FIPS Test Failures (#203008) 2025-01-14 07:53:28 -05:00
generating_oas_for_http_apis.mdx [OAS] Support examples (and more) (#212495) 2025-03-14 14:56:28 +01:00
kibana_page_template.mdx Upgrade EUI to v63.0.6 - updates to new EuiPageTemplate and deprecates old page components (#139524) 2022-09-07 15:35:23 -05:00
saved_objects.mdx Document that index/enable: false SO mappings is an anti-pattern (#201969) 2024-11-28 17:50:34 -06:00
submit_a_pull_request.mdx [ci] Remove duplicate backport action (#190643) 2024-08-20 08:23:25 -05:00
testing_plugins.mdx Updates internal dev docs for Saved Objects (#178058) 2024-03-07 08:16:28 -07:00
versioning_http_apis.mdx [dev-docs] Adds section explaining internal and public APIs (#195840) 2024-10-11 16:16:47 +00:00
versioning_interfaces.mdx [Versioned APIs] Versioned interfaces dev docs guide (#150705) 2023-03-01 16:45:43 +01:00