mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.18`: - [[OAS] Remove `Elastic-Api-Version` (#207071)](https://github.com/elastic/kibana/pull/207071) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jean-Louis Leysens","email":"jeanlouis.leysens@elastic.co"},"sourceCommit":{"committedDate":"2025-01-30T15:59:45Z","message":"[OAS] Remove `Elastic-Api-Version` (#207071)\n\n## Summary\r\n\r\nWe anticipate generating a single document per API version for the\r\nforeseeable future. This PR updates our OAS document merging logic to\r\navoid adding the `Elastic-Api-Version` header to our spec.\r\n\r\nThis will also remove this header from current documentation.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"53cba303e55c6c7d0060908938c343931513d114","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport missing","v9.0.0","Feature:OAS","backport:version","v8.18.0"],"title":"[OAS] Remove `Elastic-Api-Version`","number":207071,"url":"https://github.com/elastic/kibana/pull/207071","mergeCommit":{"message":"[OAS] Remove `Elastic-Api-Version` (#207071)\n\n## Summary\r\n\r\nWe anticipate generating a single document per API version for the\r\nforeseeable future. This PR updates our OAS document merging logic to\r\navoid adding the `Elastic-Api-Version` header to our spec.\r\n\r\nThis will also remove this header from current documentation.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"53cba303e55c6c7d0060908938c343931513d114"}},"sourceBranch":"main","suggestedTargetBranches":["8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207071","number":207071,"mergeCommit":{"message":"[OAS] Remove `Elastic-Api-Version` (#207071)\n\n## Summary\r\n\r\nWe anticipate generating a single document per API version for the\r\nforeseeable future. This PR updates our OAS document merging logic to\r\navoid adding the `Elastic-Api-Version` header to our spec.\r\n\r\nThis will also remove this header from current documentation.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"53cba303e55c6c7d0060908938c343931513d114"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
4f55a401a6
commit
a4cd9d31f1
8 changed files with 944 additions and 948 deletions
File diff suppressed because it is too large
Load diff
|
@ -7,10 +7,10 @@ actions:
|
|||
# Add some alerting API examples
|
||||
- target: "$.paths['/api/alerting/rule/{id}']['post']"
|
||||
description: "Add examples to create rule API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
createEsQueryEsqlRuleRequest:
|
||||
$ref: "../examples/create_es_query_esql_rule_request.yaml"
|
||||
|
@ -25,7 +25,7 @@ actions:
|
|||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
createEsQueryEsqlRuleResponse:
|
||||
$ref: "../examples/create_es_query_esql_rule_response.yaml"
|
||||
|
@ -39,17 +39,17 @@ actions:
|
|||
$ref: "../examples/create_tracking_containment_rule_response.yaml"
|
||||
- target: "$.paths['/api/alerting/rule/{id}']['put']"
|
||||
description: "Add examples to update rule API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
updateRuleRequest:
|
||||
$ref: '../examples/update_rule_request.yaml'
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
updateRuleResponse:
|
||||
$ref: '../examples/update_rule_response.yaml'
|
||||
|
@ -59,7 +59,7 @@ actions:
|
|||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
findRulesResponse:
|
||||
$ref: '../examples/find_rules_response.yaml'
|
||||
|
@ -77,10 +77,10 @@ actions:
|
|||
# Add some alerting rule parameters
|
||||
- target: "$.paths['/api/alerting/rule/{id}']['post']"
|
||||
description: "Add params to create rule API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
params:
|
||||
|
@ -147,4 +147,3 @@ actions:
|
|||
# Threshold rule (siem.thresholdRule)
|
||||
# TLS certificate rule (xpack.uptime.alerts.tlsCertificate)
|
||||
# Transform health (transform_health)
|
||||
|
|
@ -12,10 +12,10 @@ actions:
|
|||
# Add some connector API examples
|
||||
- target: "$.paths['/api/actions/connector/{id}']['post']"
|
||||
description: "Add examples to create connector API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
createEmailConnectorRequest:
|
||||
$ref: "../examples/create_email_connector_request.yaml"
|
||||
|
@ -28,7 +28,7 @@ actions:
|
|||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
createEmailConnectorResponse:
|
||||
$ref: "../examples/create_email_connector_response.yaml"
|
||||
|
@ -40,10 +40,10 @@ actions:
|
|||
$ref: "../examples/get_connector_response.yaml"
|
||||
- target: "$.paths['/api/actions/connector/{id}/_execute']['post']"
|
||||
description: "Add examples to run connector API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
runIndexConnectorRequest:
|
||||
$ref: "../examples/run_index_connector_request.yaml"
|
||||
|
@ -58,7 +58,7 @@ actions:
|
|||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
runIndexConnectorResponse:
|
||||
$ref: "../examples/run_index_connector_response.yaml"
|
||||
|
@ -78,7 +78,7 @@ actions:
|
|||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
getConnectorResponse:
|
||||
$ref: '../examples/get_connector_response.yaml'
|
||||
|
@ -89,7 +89,7 @@ actions:
|
|||
200:
|
||||
description: Indicates a successful call.
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
getConnectorTypesServerlessResponse:
|
||||
$ref: '../examples/get_connector_types_generativeai_response.yaml'
|
||||
|
@ -100,16 +100,16 @@ actions:
|
|||
200:
|
||||
description: Indicates a successful call.
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
getConnectorsResponse:
|
||||
$ref: '../examples/get_connectors_response.yaml'
|
||||
- target: "$.paths['/api/actions/connector/{id}']['put']"
|
||||
description: "Add examples to update connector API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
updateIndexConnectorRequest:
|
||||
$ref: '../examples/update_index_connector_request.yaml'
|
||||
|
@ -129,10 +129,10 @@ actions:
|
|||
# Add some connector configuration schemas
|
||||
- target: "$.paths['/api/actions/connector/{id}']['post']"
|
||||
description: "Add config and secrets to create connector API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
config:
|
||||
|
@ -246,10 +246,10 @@ actions:
|
|||
- $ref: '../../x-pack/platform/plugins/shared/actions/docs/openapi/components/schemas/xmatters_secrets.yaml'
|
||||
- target: "$.paths['/api/actions/connector/{id}']['put']"
|
||||
description: "Add config and secrets to update connector API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
config:
|
||||
|
@ -365,13 +365,13 @@ actions:
|
|||
- target: "$.paths['/api/actions/connector/{id}/_execute']['post'].requestBody.content.*.schema.properties.params"
|
||||
description: "Remove params in run connector API"
|
||||
remove: true
|
||||
# Add some run connector params
|
||||
# Add some run connector params
|
||||
- target: "$.paths['/api/actions/connector/{id}/_execute']['post']"
|
||||
description: "Add examples to run connector API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
params:
|
||||
|
|
|
@ -7,39 +7,39 @@ actions:
|
|||
# Add some spaces API examples
|
||||
- target: "$.paths['/api/spaces/space']['post']"
|
||||
description: "Add example to create space API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
createSpaceRequest:
|
||||
$ref: "../examples/create_space_request.yaml"
|
||||
- target: "$.paths['/api/spaces/space/{id}']['put']"
|
||||
description: "Add example to update space API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
updateSpaceRequest:
|
||||
$ref: "../examples/update_space_request.yaml"
|
||||
- target: "$.paths['/api/spaces/space/{id}']['get']"
|
||||
description: "Add example to get space API"
|
||||
update:
|
||||
update:
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
getSpaceResponseExample:
|
||||
$ref: "../examples/get_space_response.yaml"
|
||||
- target: "$.paths['/api/spaces/space']['get']"
|
||||
description: "Add example to get all spaces API"
|
||||
update:
|
||||
update:
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
getSpacesResponseExample1:
|
||||
$ref: "../examples/get_spaces_response1.yaml"
|
||||
|
|
|
@ -41,7 +41,7 @@ actions:
|
|||
update:
|
||||
description: >
|
||||
Alerting enables you to define rules, which detect complex conditions within your data.
|
||||
When a condition is met, the rule tracks it as an alert and runs the actions that are defined in the rule.
|
||||
When a condition is met, the rule tracks it as an alert and runs the actions that are defined in the rule.
|
||||
Actions typically involve the use of connectors to interact with Kibana services or third party integrations.
|
||||
externalDocs:
|
||||
description: Alerting documentation
|
||||
|
@ -109,19 +109,19 @@ actions:
|
|||
# Examples that are not applicable to serverless
|
||||
- target: "$.paths['/api/spaces/_copy_saved_objects']['post']"
|
||||
description: "Add example to copy saved objects to space API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
copySavedObjectsRequestExample1:
|
||||
$ref: "../examples/copy_saved_objects_request1.yaml"
|
||||
copySavedObjectsRequestExample2:
|
||||
$ref: "../examples/copy_saved_objects_request2.yaml"
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
copySavedObjectsResponseExample1:
|
||||
$ref: "../examples/copy_saved_objects_response1.yaml"
|
||||
|
@ -133,19 +133,19 @@ actions:
|
|||
$ref: "../examples/copy_saved_objects_response4.yaml"
|
||||
- target: "$.paths['/api/spaces/_resolve_copy_saved_objects_errors']['post']"
|
||||
description: "Add example to resolve copy saved objects to space conflicts API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
resolveCopySavedObjectsRequestExample1:
|
||||
$ref: "../examples/resolve_copy_saved_objects_request1.yaml"
|
||||
resolveCopySavedObjectsRequestExample2:
|
||||
$ref: "../examples/resolve_copy_saved_objects_request2.yaml"
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
resolveCopySavedObjectsResponseExample1:
|
||||
$ref: "../examples/copy_saved_objects_response1.yaml"
|
||||
|
@ -153,35 +153,35 @@ actions:
|
|||
$ref: "../examples/copy_saved_objects_response2.yaml"
|
||||
- target: "$.paths['/api/spaces/_disable_legacy_url_aliases']['post']"
|
||||
description: "Add example to disable legacy URL aliases API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
disableLegacyURLRequestExample1:
|
||||
$ref: "../examples/disable_legacy_url_request1.yaml"
|
||||
- target: "$.paths['/api/spaces/_update_objects_spaces']['post']"
|
||||
description: "Add example to update saved object spaces API"
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
updateObjectSpacesRequestExample1:
|
||||
$ref: "../examples/update_saved_objects_spaces_request1.yaml"
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
updateObjectSpacesResponseExample1:
|
||||
$ref: "../examples/update_saved_objects_spaces_response1.yaml"
|
||||
- target: "$.paths['/api/security/role/{name}']['put']"
|
||||
description: "Add examples to create role API"
|
||||
update:
|
||||
update:
|
||||
requestBody:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
createRoleRequest1:
|
||||
$ref: "../examples/create_role_request1.yaml"
|
||||
|
@ -197,7 +197,7 @@ actions:
|
|||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
getRoleResponse1:
|
||||
$ref: '../examples/get_role_response1.yaml'
|
||||
|
@ -207,7 +207,7 @@ actions:
|
|||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
application/json:
|
||||
examples:
|
||||
getRolesResponse1:
|
||||
$ref: '../examples/get_roles_response1.yaml'
|
||||
|
|
|
@ -17,7 +17,6 @@ import { mergeSecurityRequirements } from './merge_security_requirements';
|
|||
import { mergeTags } from './merge_tags';
|
||||
import { getOasVersion } from '../../utils/get_oas_version';
|
||||
import { getOasDocumentVersion } from '../../utils/get_oas_document_version';
|
||||
import { enrichWithVersionMimeParam } from './enrich_with_version_mime_param';
|
||||
import { MergeOptions } from './merge_options';
|
||||
|
||||
interface MergeDocumentsOptions extends MergeOptions {
|
||||
|
@ -34,10 +33,6 @@ export async function mergeDocuments(
|
|||
: new Map([['', resolvedDocuments]]);
|
||||
const mergedByVersion = new Map<string, OpenAPIV3.Document>();
|
||||
|
||||
if (!options.splitDocumentsByVersion) {
|
||||
enrichWithVersionMimeParam(resolvedDocuments);
|
||||
}
|
||||
|
||||
for (const [apiVersion, documentsGroup] of documentsByVersion.entries()) {
|
||||
validateSameOasVersion(documentsGroup);
|
||||
|
||||
|
|
|
@ -70,7 +70,9 @@ describe('OpenAPI Merger - merge paths', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('merges different versions of the same endpoint', async () => {
|
||||
// We do not expect to merge different versions of the same endpoint for the foreseeable future. This might change
|
||||
// so keeping this test around for now.
|
||||
it.skip('merges different versions of the same endpoint', async () => {
|
||||
const spec1 = createOASDocument({
|
||||
info: {
|
||||
version: '2023-10-31',
|
||||
|
|
|
@ -86,7 +86,7 @@ describe('OpenAPI Merger - merging specs with conflicting components', () => {
|
|||
|
||||
expect(mergedSpec.paths['/api/some_api']?.get?.responses['200']).toMatchObject({
|
||||
content: {
|
||||
'application/json; Elastic-Api-Version=2023-10-31': {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Spec1_SomeSchema',
|
||||
},
|
||||
|
@ -95,7 +95,7 @@ describe('OpenAPI Merger - merging specs with conflicting components', () => {
|
|||
});
|
||||
expect(mergedSpec.paths['/api/some_api']?.post?.responses['200']).toMatchObject({
|
||||
content: {
|
||||
'application/json; Elastic-Api-Version=2023-10-31': {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Spec2_SomeSchema',
|
||||
},
|
||||
|
@ -457,7 +457,7 @@ describe('OpenAPI Merger - merging specs with conflicting components', () => {
|
|||
|
||||
expect(mergedSpec.paths['/api/some_api']?.post?.requestBody).toMatchObject({
|
||||
content: {
|
||||
'application/json; Elastic-Api-Version=2023-10-31': {
|
||||
'application/json': {
|
||||
encoding: {
|
||||
something: {
|
||||
headers: {
|
||||
|
@ -779,7 +779,7 @@ describe('OpenAPI Merger - merging specs with conflicting components', () => {
|
|||
|
||||
expect(mergedSpec.paths['/api/some_api']?.get?.responses['200']).toMatchObject({
|
||||
content: {
|
||||
'application/json; Elastic-Api-Version=2023-10-31': {
|
||||
'application/json': {
|
||||
schema: expect.objectContaining({
|
||||
discriminator: expect.objectContaining({
|
||||
mapping: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue