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 GenAI][Integration Assistant] Create OpenAPI spec for Integration Assistant APIs #186085

Merged
merged 39 commits into from
Jun 18, 2024

Conversation

bhapas
Copy link
Contributor

@bhapas bhapas commented Jun 12, 2024

Summary

This PR adds OpenAPI spec to the integration assistant APIs introduced in #184296


Follow-up changes

Had a discussion with @maximpn and realized that currently zod library does not support recursion and a workaround is followed.

Hence the xpack-codegen-enabled is set to false and the generated TS files are renamed to remove .gen from the naming to keep them static until a fix is in place.

Checklist

Delete any items that are not applicable to this PR.

  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@bhapas
Copy link
Contributor Author

bhapas commented Jun 17, 2024

@elasticmachine merge upstream

@bhapas
Copy link
Contributor Author

bhapas commented Jun 17, 2024

/ci

@bhapas
Copy link
Contributor Author

bhapas commented Jun 17, 2024

@elasticmachine merge upstream

@bhapas bhapas added the Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. label Jun 17, 2024
@bhapas bhapas changed the title Create OpenAPI spec for Integration Assistant APIs [Security GenAI][Integration Assistant] Create OpenAPI spec for Integration Assistant APIs Jun 17, 2024
@bhapas bhapas added the backport:skip This commit does not require backporting label Jun 17, 2024
@bhapas
Copy link
Contributor Author

bhapas commented Jun 17, 2024

@elasticmachine merge upstream

@bhapas
Copy link
Contributor Author

bhapas commented Jun 17, 2024

/ci

@bhapas
Copy link
Contributor Author

bhapas commented Jun 17, 2024

/ci

@bhapas
Copy link
Contributor Author

bhapas commented Jun 18, 2024

@elasticmachine merge upstream

@bhapas
Copy link
Contributor Author

bhapas commented Jun 18, 2024

/ci

@bhapas bhapas marked this pull request as ready for review June 18, 2024 08:03
@bhapas bhapas requested a review from a team as a code owner June 18, 2024 08:03
@bhapas bhapas removed request for a team, tiansivive, e40pud and nikitaindik June 18, 2024 17:35
@bhapas bhapas removed Team:Fleet Team label for Observability Data Collection Fleet team ci:project-deploy-observability Create an Observability project Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Jun 18, 2024
@kibana-ci
Copy link
Collaborator

kibana-ci commented Jun 18, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

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
integrationAssistant 69 33 -36

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
integrationAssistant 0 1 +1
Unknown metric groups

API count

id before after diff
integrationAssistant 69 38 -31

History

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

cc @bhapas

@bhapas bhapas merged commit a455012 into elastic:main Jun 18, 2024
22 checks passed
@bhapas bhapas deleted the openai_integration_assistant branch June 18, 2024 20:20
bhapas added a commit that referenced this pull request Sep 18, 2024
…193243)

## Summary

#186085 introduced OpenAPI spec
for Automatic Import APIs. Since there was a
[bug](#186221) `x-codegen-enabled`
was set to `false`.

This PR modifies it to `true` and `node scripts/generate_openapi`
generated new API classes for the spec.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 18, 2024
…lastic#193243)

## Summary

elastic#186085 introduced OpenAPI spec
for Automatic Import APIs. Since there was a
[bug](elastic#186221) `x-codegen-enabled`
was set to `false`.

This PR modifies it to `true` and `node scripts/generate_openapi`
generated new API classes for the spec.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit e4180d2)
bhapas added a commit to bhapas/kibana that referenced this pull request Sep 18, 2024
…lastic#193243)

## Summary

elastic#186085 introduced OpenAPI spec
for Automatic Import APIs. Since there was a
[bug](elastic#186221) `x-codegen-enabled`
was set to `false`.

This PR modifies it to `true` and `node scripts/generate_openapi`
generated new API classes for the spec.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit e4180d2)

# Conflicts:
#	x-pack/plugins/integration_assistant/common/api/build_integration/build_integration.gen.ts
#	x-pack/plugins/integration_assistant/common/api/categorization/categorization_route.gen.ts
#	x-pack/plugins/integration_assistant/common/api/check_pipeline/check_pipeline.gen.ts
#	x-pack/plugins/integration_assistant/common/api/model/common_attributes.gen.ts
#	x-pack/plugins/integration_assistant/common/api/model/processor_attributes.ts
#	x-pack/plugins/integration_assistant/common/api/related/related_route.gen.ts
bhapas added a commit that referenced this pull request Sep 18, 2024
… code (#193243) (#193297)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Automatic Import] Modify codegen to autogenerate openAPI spec code
(#193243)](#193243)

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

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

<!--BACKPORT [{"author":{"name":"Bharat
Pasupula","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-18T13:02:24Z","message":"[Automatic
Import] Modify codegen to autogenerate openAPI spec code (#193243)\n\n##
Summary\r\n\r\nhttps://github.com//pull/186085 introduced
OpenAPI spec\r\nfor Automatic Import APIs. Since there was
a\r\n[bug](#186221)
`x-codegen-enabled`\r\nwas set to `false`.\r\n\r\nThis PR modifies it to
`true` and `node scripts/generate_openapi`\r\ngenerated new API classes
for the spec.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e4180d211a06513cf51328da090ea14315880201","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","v9.0.0","backport:prev-major","Team:Security-Scalability","Feature:AutomaticImport"],"number":193243,"url":"https://github.com/elastic/kibana/pull/193243","mergeCommit":{"message":"[Automatic
Import] Modify codegen to autogenerate openAPI spec code (#193243)\n\n##
Summary\r\n\r\nhttps://github.com//pull/186085 introduced
OpenAPI spec\r\nfor Automatic Import APIs. Since there was
a\r\n[bug](#186221)
`x-codegen-enabled`\r\nwas set to `false`.\r\n\r\nThis PR modifies it to
`true` and `node scripts/generate_openapi`\r\ngenerated new API classes
for the spec.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e4180d211a06513cf51328da090ea14315880201"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193243","number":193243,"mergeCommit":{"message":"[Automatic
Import] Modify codegen to autogenerate openAPI spec code (#193243)\n\n##
Summary\r\n\r\nhttps://github.com//pull/186085 introduced
OpenAPI spec\r\nfor Automatic Import APIs. Since there was
a\r\n[bug](#186221)
`x-codegen-enabled`\r\nwas set to `false`.\r\n\r\nThis PR modifies it to
`true` and `node scripts/generate_openapi`\r\ngenerated new API classes
for the spec.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e4180d211a06513cf51328da090ea14315880201"}},{"url":"https://github.com/elastic/kibana/pull/193290","number":193290,"branch":"8.x","state":"OPEN"}]}]
BACKPORT-->
kibanamachine added a commit that referenced this pull request Sep 18, 2024
…code (#193243) (#193290)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Automatic Import] Modify codegen to autogenerate openAPI spec code
(#193243)](#193243)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Bharat
Pasupula","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-18T13:02:24Z","message":"[Automatic
Import] Modify codegen to autogenerate openAPI spec code (#193243)\n\n##
Summary\r\n\r\nhttps://github.com//pull/186085 introduced
OpenAPI spec\r\nfor Automatic Import APIs. Since there was
a\r\n[bug](#186221)
`x-codegen-enabled`\r\nwas set to `false`.\r\n\r\nThis PR modifies it to
`true` and `node scripts/generate_openapi`\r\ngenerated new API classes
for the spec.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e4180d211a06513cf51328da090ea14315880201","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","v9.0.0","backport:prev-major","Team:Security-Scalability","Feature:AutomaticImport"],"title":"[Automatic
Import] Modify codegen to autogenerate openAPI spec
code","number":193243,"url":"https://github.com/elastic/kibana/pull/193243","mergeCommit":{"message":"[Automatic
Import] Modify codegen to autogenerate openAPI spec code (#193243)\n\n##
Summary\r\n\r\nhttps://github.com//pull/186085 introduced
OpenAPI spec\r\nfor Automatic Import APIs. Since there was
a\r\n[bug](#186221)
`x-codegen-enabled`\r\nwas set to `false`.\r\n\r\nThis PR modifies it to
`true` and `node scripts/generate_openapi`\r\ngenerated new API classes
for the spec.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e4180d211a06513cf51328da090ea14315880201"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193243","number":193243,"mergeCommit":{"message":"[Automatic
Import] Modify codegen to autogenerate openAPI spec code (#193243)\n\n##
Summary\r\n\r\nhttps://github.com//pull/186085 introduced
OpenAPI spec\r\nfor Automatic Import APIs. Since there was
a\r\n[bug](#186221)
`x-codegen-enabled`\r\nwas set to `false`.\r\n\r\nThis PR modifies it to
`true` and `node scripts/generate_openapi`\r\ngenerated new API classes
for the spec.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e4180d211a06513cf51328da090ea14315880201"}}]}]
BACKPORT-->

Co-authored-by: Bharat Pasupula <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.15 candidate backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.