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

[Security Solution] Add tags by OpenAPI bundler #189621

Merged
merged 6 commits into from
Aug 2, 2024

Conversation

maximpn
Copy link
Contributor

@maximpn maximpn commented Jul 31, 2024

Resolves: #183375

Summary

This PR implements functionality assigning a provided tag to OpenAPI Operation objects in the result bundle. Specified tag is also added as the only root level OpenAPI tag. This approach allows to produce domain bundles having a single tag assigned. At the next step domain bundles are merged together into single Kibana bundle where tags will allow to properly display grouping at Bump.sh (API reference documentation platform).

Details

Bump.sh (our new API reference documentation platform) uses OpenAPI tags for grouping API endpoints. It supports only one tag per endpoint.

This PR facilitates preparation of Kibana OpenAPI bundle to be uploaded to Bump.sh by implementing functionality assigning a provided tag to OpenAPI Operation objects in the result domain bundles. It's implemented by providing an optional configuration option assignTag whose format is OpenAPI Tag Object. When assignTag isn't specified the bundler merges existing tags.

Example

Consider the following bundling configuration

const { bundle } = require('@kbn/openapi-bundler');

bundle({
  // ...
  options: {
    assignTag: {
      name: 'Some Domain API tag name',
      description: 'Some Domain API description',
      externalDocs: {
        url: 'https://some-external-documentation-url',
        description: 'External documentation description',
    }
  },
});

and source OpenAPI specs

spec1.schema.yaml

openapi: 3.0.3
info:
  title: Spec1
  version: '2023-10-31'
paths:
  /api/some_api:
    get:
      tags: ['Some local tag']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string

spec2.schema.yaml

openapi: 3.0.3
info:
  title: Spec2
  version: '2023-10-31'
paths:
  /api/some_api:
    post:
      tags: ['Some global tag']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
tags:
  - name: Some global tag

spec2.schema.yaml

openapi: 3.0.3
info:
  title: Spec3
  version: '2023-10-31'
paths:
  /api/another_api:
    get:
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string

After bundling above OpenAPI specs with the provided bundling script we'll get the following

domain-bundle.schema.yaml

openapi: 3.0.3
info:
  title: Bundled document
  version: '2023-10-31'
paths:
  /api/some_api:
    get:
      tags: ['Some Domain API tag name']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
    post:
      tags: ['Some Domain API tag name']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
  /api/another_api:
    get:
      tags: ['Some Domain API tag name']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
tags:
  - name: Some Domain API tag name
    description: Some Domain API description
    externalDocs:
      url: 'https://some-external-documentation-url'
      description: External documentation description

@maximpn maximpn added release_note:skip Skip the PR/issue when compiling release notes docs Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team v8.16.0 labels Jul 31, 2024
@maximpn maximpn self-assigned this Jul 31, 2024
@maximpn maximpn requested a review from xcrzx July 31, 2024 11:19
@maximpn
Copy link
Contributor Author

maximpn commented Jul 31, 2024

Hi @xcrzx,

You may notice this PR removes existing tags only for some certain API domains. It feels like we still could use tagging inside API domains later on for example in code generation. Specs for Lists API, Exceptions API and Endpoint Exceptions API just had the same value and don't bring too much value that's why I removed them.

WDYT?

@maximpn maximpn marked this pull request as ready for review July 31, 2024 11:27
@maximpn maximpn requested review from a team as code owners July 31, 2024 11:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@xcrzx
Copy link
Contributor

xcrzx commented Aug 1, 2024

Hi @xcrzx,

You may notice this PR removes existing tags only for some certain API domains. It feels like we still could use tagging inside API domains later on for example in code generation. Specs for Lists API, Exceptions API and Endpoint Exceptions API just had the same value and don't bring too much value that's why I removed them.

WDYT?

I initially added tags to group API endpoints based on their domains, so in standard OpenAPI viewers, they wouldn't appear as one big list. Since the bundler and merger now handle producing a correctly categorized schema, I'm okay with removing the old tags from the sources.

@maximpn maximpn force-pushed the assign-tags-by-oas-bundler branch from d5772d1 to 6125ec2 Compare August 1, 2024 14:41
@maximpn maximpn requested a review from a team as a code owner August 1, 2024 14:41
@maximpn maximpn force-pushed the assign-tags-by-oas-bundler branch 3 times, most recently from b51e691 to 30c7336 Compare August 2, 2024 09:37
@maximpn maximpn changed the title [Security Solution] Assign tag by OpenAPI bundler [Security Solution] Add tags by OpenAPI bundler Aug 2, 2024
Copy link
Contributor

@xcrzx xcrzx left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for resolving my comments 👍

@maximpn maximpn force-pushed the assign-tags-by-oas-bundler branch from 11032a0 to 593981e Compare August 2, 2024 10:44
@maximpn
Copy link
Contributor Author

maximpn commented Aug 2, 2024

Files by Code Owner

elastic/security-defend-workflows

  • x-pack/plugins/osquery/docs/openapi/ess/osquery_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/osquery/docs/openapi/serverless/osquery_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/osquery/scripts/openapi/bundle.js

elastic/security-detection-engine

  • packages/kbn-securitysolution-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.schema.yaml
  • packages/kbn-securitysolution-endpoint-exceptions-common/api/create_endpoint_list_item/create_endpoint_list_item.schema.yaml
  • packages/kbn-securitysolution-endpoint-exceptions-common/api/delete_endpoint_list_item/delete_endpoint_list_item.schema.yaml
  • packages/kbn-securitysolution-endpoint-exceptions-common/api/find_endpoint_list_item/find_endpoint_list_item.schema.yaml
  • packages/kbn-securitysolution-endpoint-exceptions-common/api/read_endpoint_list_item/read_endpoint_list_item.schema.yaml
  • packages/kbn-securitysolution-endpoint-exceptions-common/api/update_endpoint_list_item/update_endpoint_list_item.schema.yaml
  • packages/kbn-securitysolution-endpoint-exceptions-common/docs/openapi/ess/security_solution_endpoint_exceptions_api_2023_10_31.bundled.schema.yaml
  • packages/kbn-securitysolution-endpoint-exceptions-common/docs/openapi/serverless/security_solution_endpoint_exceptions_api_2023_10_31.bundled.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/create_exception_list/create_exception_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/create_exception_list_item/create_exception_list_item.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/create_rule_exceptions/create_rule_exceptions.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/create_shared_exceptions_list/create_shared_exceptions_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/delete_exception_list/delete_exception_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/delete_exception_list_item/delete_exception_list_item.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/duplicate_exception_list/duplicate_exception_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/export_exception_list/export_exception_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/find_exception_list/find_exception_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/find_exception_list_item/find_exception_list_item.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/import_exceptions/import_exceptions.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/read_exception_list/read_exception_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/read_exception_list_item/read_exception_list_item.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/summary_exception_list/summary_exception_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/update_exception_list/update_exception_list.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/api/update_exception_list_item/update_exception_list_item.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/docs/openapi/ess/security_solution_exceptions_api_2023_10_31.bundled.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/docs/openapi/serverless/security_solution_exceptions_api_2023_10_31.bundled.schema.yaml
  • packages/kbn-securitysolution-exceptions-common/scripts/openapi_bundle.js
  • packages/kbn-securitysolution-lists-common/api/create_list/create_list.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/create_list_index/create_list_index.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/create_list_item/create_list_item.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/delete_list/delete_list.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/delete_list_index/delete_list_index.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/delete_list_item/delete_list_item.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/export_list_item/export_list_item.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/find_list/find_list.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/find_list_item/find_list_item.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/get_list_privileges/get_list_privileges.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/import_list_item/import_list_item.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/patch_list/patch_list.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/patch_list_item/patch_list_item.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/read_list/read_list.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/read_list_index/read_list_index.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/read_list_item/read_list_item.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/update_list/update_list.schema.yaml
  • packages/kbn-securitysolution-lists-common/api/update_list_item/update_list_item.schema.yaml
  • packages/kbn-securitysolution-lists-common/docs/openapi/ess/security_solution_lists_api_2023_10_31.bundled.schema.yaml
  • packages/kbn-securitysolution-lists-common/docs/openapi/serverless/security_solution_lists_api_2023_10_31.bundled.schema.yaml
  • packages/kbn-securitysolution-lists-common/scripts/openapi_bundle.js

elastic/security-detection-rule-management

  • packages/kbn-openapi-bundler/src/bundler/merge_documents/merge_documents.ts
  • packages/kbn-openapi-bundler/src/bundler/merge_documents/merge_operations.ts
  • packages/kbn-openapi-bundler/src/bundler/merge_documents/merge_options.ts
  • packages/kbn-openapi-bundler/src/openapi_bundler.ts
  • packages/kbn-openapi-bundler/src/openapi_merger.ts
  • packages/kbn-openapi-bundler/src/prototype_document.ts
  • packages/kbn-openapi-bundler/src/validate_prototype_document.ts
  • packages/kbn-openapi-bundler/tests/bundler/result_overrides/add_tags.test.ts
  • packages/kbn-openapi-bundler/tests/merger/result_overrides/add_tags.test.ts
  • x-pack/plugins/security_solution/scripts/openapi/bundle_detections.js
  • x-pack/plugins/security_solution/scripts/openapi/bundle_endpoint_management.js
  • x-pack/plugins/security_solution/scripts/openapi/bundle_entity_analytics.js
  • x-pack/plugins/security_solution/scripts/openapi/bundle_timeline.js

elastic/security-generative-ai

  • x-pack/packages/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml
  • x-pack/packages/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml
  • x-pack/packages/kbn-elastic-assistant-common/scripts/openapi/bundle.js

elastic/security-solution

  • x-pack/plugins/security_solution/docs/openapi/ess/security_solution_detections_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/security_solution/docs/openapi/ess/security_solution_endpoint_management_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/security_solution/docs/openapi/ess/security_solution_entity_analytics_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/security_solution/docs/openapi/ess/security_solution_timeline_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/security_solution/docs/openapi/serverless/security_solution_detections_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/security_solution/docs/openapi/serverless/security_solution_endpoint_management_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/security_solution/docs/openapi/serverless/security_solution_entity_analytics_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/security_solution/docs/openapi/serverless/security_solution_timeline_api_2023_10_31.bundled.schema.yaml
  • x-pack/plugins/security_solution/scripts/openapi/bundle_detections.js
  • x-pack/plugins/security_solution/scripts/openapi/bundle_endpoint_management.js
  • x-pack/plugins/security_solution/scripts/openapi/bundle_entity_analytics.js
  • x-pack/plugins/security_solution/scripts/openapi/bundle_timeline.js

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

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

cc @maximpn

@maximpn maximpn merged commit 845dd1f into elastic:main Aug 2, 2024
43 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Aug 2, 2024
@maximpn maximpn deleted the assign-tags-by-oas-bundler branch August 2, 2024 14:41
lcawl pushed a commit to lcawl/kibana that referenced this pull request Aug 20, 2024
**Resolves:** elastic#183375

This PR implements functionality assigning a provided tag to OpenAPI `Operation object`s in the result bundle. Specified tag is also added as the only root level OpenAPI tag. This approach allows to produce domain bundles having a single tag assigned. At the next step domain bundles are merged together into single Kibana bundle where tags will allow to properly display grouping at Bump.sh (API reference documentation platform).

Bump.sh (our new API reference documentation platform) uses OpenAPI tags for grouping API endpoints. It supports only one tag per endpoint.

This PR facilitates preparation of Kibana OpenAPI bundle to be uploaded to Bump.sh by implementing functionality assigning a provided tag to OpenAPI `Operation object`s in the result domain bundles. It's implemented by providing an optional configuration option `assignTag` whose format is OpenAPI Tag Object. When `assignTag` isn't specified the bundler merges existing tags.

Consider the following bundling configuration

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

bundle({
  // ...
  options: {
    assignTag: {
      name: 'Some Domain API tag name',
      description: 'Some Domain API description',
      externalDocs: {
        url: 'https://some-external-documentation-url',
        description: 'External documentation description',
    }
  },
});
```

and source OpenAPI specs

**spec1.schema.yaml**
```yaml
openapi: 3.0.3
info:
  title: Spec1
  version: '2023-10-31'
paths:
  /api/some_api:
    get:
      tags: ['Some local tag']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
```

**spec2.schema.yaml**
```yaml
openapi: 3.0.3
info:
  title: Spec2
  version: '2023-10-31'
paths:
  /api/some_api:
    post:
      tags: ['Some global tag']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
tags:
  - name: Some global tag
```

**spec2.schema.yaml**
```yaml
openapi: 3.0.3
info:
  title: Spec3
  version: '2023-10-31'
paths:
  /api/another_api:
    get:
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
```

After bundling above OpenAPI specs with the provided bundling script we'll get the following

**domain-bundle.schema.yaml**
```yaml
openapi: 3.0.3
info:
  title: Bundled document
  version: '2023-10-31'
paths:
  /api/some_api:
    get:
      tags: ['Some Domain API tag name']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
    post:
      tags: ['Some Domain API tag name']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
  /api/another_api:
    get:
      tags: ['Some Domain API tag name']
      responses:
        200:
          content:
            'application/json':
              schema:
                type: string
tags:
  - name: Some Domain API tag name
    description: Some Domain API description
    externalDocs:
      url: 'https://some-external-documentation-url'
      description: External documentation description
```
lcawl added a commit that referenced this pull request Aug 20, 2024
…189262) (#190541)

# Backport

This will backport the bundler aspects of the following commits from
`main` to `8.15`:
- [[HTTP/OAS] Merge OpenAPI specs by using `kbn-openapi-bundler`
(#189262)](#189262)
 - #189621
 - #189482
 - #189348
 - #189472
 - #188110
 - #188812

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-08-13T10:45:35Z","message":"[HTTP/OAS]
Merge OpenAPI specs by using `kbn-openapi-bundler`
(#189262)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/186356\r\n**Relates to:**
https://github.com/elastic/kibana/issues/184428\r\n\r\n##
Summary\r\n\r\nThis PR adds a merging JS script based on the utility
implemented in #186356. Resulted
OpenAPI bundle as committed in
`oas_docs/output/kibana.serverless.bundled.yaml`.\r\n\r\n##
Details\r\n\r\nhttps://github.com//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\r\n\r\n```js\r\nconst {
merge } = require('@kbn/openapi-bundler');\r\n\r\n(async () => {\r\n
await merge({\r\n sourceGlobs: [/* a list of source globs goes here
*/],\r\n outputFilePath: 'path/to/the/output/file.yaml',\r\n
});\r\n})();\r\n```\r\n\r\nThe 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.\r\n\r\n**To run** the
script use the following command from Kibana root
folder\r\n\r\n```bash\r\nnode ./oas_docs/scripts/merge_serverless_oas.js
\r\n```\r\n\r\n## Known linting issues with Security Solution OpenAPI
specs\r\n\r\nRunning 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.\r\n\r\nWe need to
analyze the problem and decide if/when we should fix it.\r\n\r\nThe rest
of warnings look fixable and will be addressed in the next stage after
setting up linter rules.\r\n\r\n## Next steps\r\n\r\nSince
`@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.\r\n\r\n`@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.","sha":"7a2e7bef9644eaf04fd820d16b8ee137b3c00f2b","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:skip","docs","Team:
SecuritySolution","Feature:OAS","v8.16.0"],"number":189262,"url":"https://github.com/elastic/kibana/pull/189262","mergeCommit":{"message":"[HTTP/OAS]
Merge OpenAPI specs by using `kbn-openapi-bundler`
(#189262)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/186356\r\n**Relates to:**
https://github.com/elastic/kibana/issues/184428\r\n\r\n##
Summary\r\n\r\nThis PR adds a merging JS script based on the utility
implemented in #186356. Resulted
OpenAPI bundle as committed in
`oas_docs/output/kibana.serverless.bundled.yaml`.\r\n\r\n##
Details\r\n\r\nhttps://github.com//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\r\n\r\n```js\r\nconst {
merge } = require('@kbn/openapi-bundler');\r\n\r\n(async () => {\r\n
await merge({\r\n sourceGlobs: [/* a list of source globs goes here
*/],\r\n outputFilePath: 'path/to/the/output/file.yaml',\r\n
});\r\n})();\r\n```\r\n\r\nThe 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.\r\n\r\n**To run** the
script use the following command from Kibana root
folder\r\n\r\n```bash\r\nnode ./oas_docs/scripts/merge_serverless_oas.js
\r\n```\r\n\r\n## Known linting issues with Security Solution OpenAPI
specs\r\n\r\nRunning 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.\r\n\r\nWe need to
analyze the problem and decide if/when we should fix it.\r\n\r\nThe rest
of warnings look fixable and will be addressed in the next stage after
setting up linter rules.\r\n\r\n## Next steps\r\n\r\nSince
`@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.\r\n\r\n`@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.","sha":"7a2e7bef9644eaf04fd820d16b8ee137b3c00f2b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/189262","number":189262,"mergeCommit":{"message":"[HTTP/OAS]
Merge OpenAPI specs by using `kbn-openapi-bundler`
(#189262)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/186356\r\n**Relates to:**
https://github.com/elastic/kibana/issues/184428\r\n\r\n##
Summary\r\n\r\nThis PR adds a merging JS script based on the utility
implemented in #186356. Resulted
OpenAPI bundle as committed in
`oas_docs/output/kibana.serverless.bundled.yaml`.\r\n\r\n##
Details\r\n\r\nhttps://github.com//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\r\n\r\n```js\r\nconst {
merge } = require('@kbn/openapi-bundler');\r\n\r\n(async () => {\r\n
await merge({\r\n sourceGlobs: [/* a list of source globs goes here
*/],\r\n outputFilePath: 'path/to/the/output/file.yaml',\r\n
});\r\n})();\r\n```\r\n\r\nThe 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.\r\n\r\n**To run** the
script use the following command from Kibana root
folder\r\n\r\n```bash\r\nnode ./oas_docs/scripts/merge_serverless_oas.js
\r\n```\r\n\r\n## Known linting issues with Security Solution OpenAPI
specs\r\n\r\nRunning 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.\r\n\r\nWe need to
analyze the problem and decide if/when we should fix it.\r\n\r\nThe rest
of warnings look fixable and will be addressed in the next stage after
setting up linter rules.\r\n\r\n## Next steps\r\n\r\nSince
`@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.\r\n\r\n`@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.","sha":"7a2e7bef9644eaf04fd820d16b8ee137b3c00f2b"}}]}]
BACKPORT-->

---------

Co-authored-by: Maxim Palenov <[email protected]>
maximpn added a commit that referenced this pull request Sep 19, 2024
…PI (#193019)

**Addresses:** #183375

## Summary

This PR adds a missing domain tag to Endpoint Exceptions API. The rest API endpoints got their tags in #189621.
maximpn added a commit to maximpn/kibana that referenced this pull request Sep 25, 2024
…PI (elastic#193019)

**Addresses:** elastic#183375

## Summary

This PR adds a missing domain tag to Endpoint Exceptions API. The rest API endpoints got their tags in elastic#189621.

(cherry picked from commit 09374ad)

# Conflicts:
#	packages/kbn-securitysolution-endpoint-exceptions-common/docs/openapi/ess/security_solution_endpoint_exceptions_api_2023_10_31.bundled.schema.yaml
#	packages/kbn-securitysolution-endpoint-exceptions-common/docs/openapi/serverless/security_solution_endpoint_exceptions_api_2023_10_31.bundled.schema.yaml
maximpn referenced this pull request Sep 25, 2024
…ions API (#193019) (#193984)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Add a missing domain tag to Endpoint Exceptions
API (#193019)](#193019)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-19T11:23:11Z","message":"[Security
Solution] Add a missing domain tag to Endpoint Exceptions API
(#193019)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/183375\r\n\r\n##
Summary\r\n\r\nThis PR adds a missing domain tag to Endpoint Exceptions
API. The rest API endpoints got their tags in
https://github.com/elastic/kibana/pull/189621.","sha":"09374ad2ce5ba96b61a1d300264d2465f34e2326","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","docs","Team:Detections
and Resp","Team: SecuritySolution","backport:prev-minor","Team:Detection
Engine","v8.16.0"],"number":193019,"url":"https://github.com/elastic/kibana/pull/193019","mergeCommit":{"message":"[Security
Solution] Add a missing domain tag to Endpoint Exceptions API
(#193019)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/183375\r\n\r\n##
Summary\r\n\r\nThis PR adds a missing domain tag to Endpoint Exceptions
API. The rest API endpoints got their tags in
https://github.com/elastic/kibana/pull/189621.","sha":"09374ad2ce5ba96b61a1d300264d2465f34e2326"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193019","number":193019,"mergeCommit":{"message":"[Security
Solution] Add a missing domain tag to Endpoint Exceptions API
(#193019)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/183375\r\n\r\n##
Summary\r\n\r\nThis PR adds a missing domain tag to Endpoint Exceptions
API. The rest API endpoints got their tags in
https://github.com/elastic/kibana/pull/189621.","sha":"09374ad2ce5ba96b61a1d300264d2465f34e2326"}},{"branch":"8.x","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <[email protected]>
maximpn added a commit to maximpn/kibana that referenced this pull request Nov 12, 2024
…PI (elastic#193019)

**Addresses:** elastic#183375

This PR adds a missing domain tag to Endpoint Exceptions API. The rest API endpoints got their tags in elastic#189621.

(cherry picked from commit 09374ad)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting docs release_note:skip Skip the PR/issue when compiling release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants