Skip to content

[OpenAPI] Do not generate imports for local references#250723

Merged
janmonschke merged 1 commit intomainfrom
openapi-generator/imports-local-references
Jan 28, 2026
Merged

[OpenAPI] Do not generate imports for local references#250723
janmonschke merged 1 commit intomainfrom
openapi-generator/imports-local-references

Conversation

@janmonschke
Copy link
Copy Markdown
Contributor

@janmonschke janmonschke commented Jan 28, 2026

Summary

I noticed that when generating schemas from yaml files with local references, the generator will create import statements for the referenced types.

openapi: 3.0.1
paths:
  /api/cases:
    post:
      parameters:
        - $ref: '#/components/parameters/kbn_xsrf'
components:
  parameters:
    kbn_xsrf:
      schema:
        type: string

Will generate:

import {, #/components/parameters/kbn_xsrf' } (...)

The fix I am proposing will skip generating import statements for local references.

@janmonschke janmonschke requested a review from a team as a code owner January 28, 2026 13:26
@janmonschke janmonschke requested a review from dplumlee January 28, 2026 13:26
@janmonschke janmonschke added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:Cases Security Solution Cases team labels Jan 28, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-cases (Team:Cases)

@maximpn maximpn requested review from maximpn and removed request for dplumlee January 28, 2026 13:32
Copy link
Copy Markdown
Contributor

@maximpn maximpn left a comment

Choose a reason for hiding this comment

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

@janmonschke Thanks for improving the OpenAPI code generator 👍

@janmonschke janmonschke enabled auto-merge (squash) January 28, 2026 14:37
@janmonschke janmonschke merged commit a304458 into main Jan 28, 2026
24 checks passed
@janmonschke janmonschke deleted the openapi-generator/imports-local-references branch January 28, 2026 15:14
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #99 / "before all" hook in "{root}"
  • [job] [logs] FTR Configs #49 / serverless search UI - search features index details page - search solution developer search index details page has index actions enabled add field button is enabled
  • [job] [logs] FTR Configs #123 / Visualizations - Group 2 lens app - Agg based Vis Open in Lens Goal "before all" hook for "should show the "Convert to Lens" menu item"

Metrics [docs]

✅ unchanged

@janmonschke janmonschke added backport:all-open Backport to all branches that could still receive a release and removed backport:skip This PR does not require backporting labels Jan 29, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.1, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/21475232772

@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.1, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/21475232814

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 29, 2026
## Summary

I noticed that when generating schemas from yaml files with local
references, the generator will create import statements for the
referenced types.

```yml
openapi: 3.0.1
paths:
  /api/cases:
    post:
      parameters:
        - $ref: '#/components/parameters/kbn_xsrf'
components:
  parameters:
    kbn_xsrf:
      schema:
        type: string
```

Will generate:

```typescript
import {, #/components/parameters/kbn_xsrf' } (...)
```

The fix I am proposing will skip generating import statements for local
references.

(cherry picked from commit a304458)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 29, 2026
## Summary

I noticed that when generating schemas from yaml files with local
references, the generator will create import statements for the
referenced types.

```yml
openapi: 3.0.1
paths:
  /api/cases:
    post:
      parameters:
        - $ref: '#/components/parameters/kbn_xsrf'
components:
  parameters:
    kbn_xsrf:
      schema:
        type: string
```

Will generate:

```typescript
import {, #/components/parameters/kbn_xsrf' } (...)
```

The fix I am proposing will skip generating import statements for local
references.

(cherry picked from commit a304458)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 29, 2026
## Summary

I noticed that when generating schemas from yaml files with local
references, the generator will create import statements for the
referenced types.

```yml
openapi: 3.0.1
paths:
  /api/cases:
    post:
      parameters:
        - $ref: '#/components/parameters/kbn_xsrf'
components:
  parameters:
    kbn_xsrf:
      schema:
        type: string
```

Will generate:

```typescript
import {, #/components/parameters/kbn_xsrf' } (...)
```

The fix I am proposing will skip generating import statements for local
references.

(cherry picked from commit a304458)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 29, 2026
## Summary

I noticed that when generating schemas from yaml files with local
references, the generator will create import statements for the
referenced types.

```yml
openapi: 3.0.1
paths:
  /api/cases:
    post:
      parameters:
        - $ref: '#/components/parameters/kbn_xsrf'
components:
  parameters:
    kbn_xsrf:
      schema:
        type: string
```

Will generate:

```typescript
import {, #/components/parameters/kbn_xsrf' } (...)
```

The fix I am proposing will skip generating import statements for local
references.

(cherry picked from commit a304458)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.1
9.2
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jan 29, 2026
#250869)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[OpenAPI] Do not generate imports for local references
(#250723)](#250723)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Jan
Monschke","email":"jan.monschke@elastic.co"},"sourceCommit":{"committedDate":"2026-01-28T15:14:18Z","message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","Team:Cases","v9.4.0"],"title":"[OpenAPI]
Do not generate imports for local
references","number":250723,"url":"https://github.com/elastic/kibana/pull/250723","mergeCommit":{"message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/250723","number":250723,"mergeCommit":{"message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206"}}]}]
BACKPORT-->

Co-authored-by: Jan Monschke <jan.monschke@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jan 29, 2026
#250868)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[OpenAPI] Do not generate imports for local references
(#250723)](#250723)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Jan
Monschke","email":"jan.monschke@elastic.co"},"sourceCommit":{"committedDate":"2026-01-28T15:14:18Z","message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","Team:Cases","v9.4.0"],"title":"[OpenAPI]
Do not generate imports for local
references","number":250723,"url":"https://github.com/elastic/kibana/pull/250723","mergeCommit":{"message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/250723","number":250723,"mergeCommit":{"message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206"}}]}]
BACKPORT-->

Co-authored-by: Jan Monschke <jan.monschke@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jan 30, 2026
… (#250866)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[OpenAPI] Do not generate imports for local references
(#250723)](#250723)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Jan
Monschke","email":"jan.monschke@elastic.co"},"sourceCommit":{"committedDate":"2026-01-28T15:14:18Z","message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","Team:Cases","v9.4.0"],"title":"[OpenAPI]
Do not generate imports for local
references","number":250723,"url":"https://github.com/elastic/kibana/pull/250723","mergeCommit":{"message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/250723","number":250723,"mergeCommit":{"message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206"}}]}]
BACKPORT-->

Co-authored-by: Jan Monschke <jan.monschke@elastic.co>
Co-authored-by: christineweng <18648970+christineweng@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jan 30, 2026
#250867)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[OpenAPI] Do not generate imports for local references
(#250723)](#250723)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Jan
Monschke","email":"jan.monschke@elastic.co"},"sourceCommit":{"committedDate":"2026-01-28T15:14:18Z","message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","Team:Cases","v9.4.0"],"title":"[OpenAPI]
Do not generate imports for local
references","number":250723,"url":"https://github.com/elastic/kibana/pull/250723","mergeCommit":{"message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/250723","number":250723,"mergeCommit":{"message":"[OpenAPI]
Do not generate imports for local references (#250723)\n\n##
Summary\n\nI noticed that when generating schemas from yaml files with
local\nreferences, the generator will create import statements for
the\nreferenced types.\n\n```yml\nopenapi: 3.0.1\npaths:\n /api/cases:\n
post:\n parameters:\n - $ref:
'#/components/parameters/kbn_xsrf'\ncomponents:\n parameters:\n
kbn_xsrf:\n schema:\n type: string\n```\n\nWill
generate:\n\n```typescript\nimport {, #/components/parameters/kbn_xsrf'
} (...)\n```\n\nThe fix I am proposing will skip generating import
statements for
local\nreferences.","sha":"a304458f9ba46cd208f9932e4af139b79560a206"}}]}]
BACKPORT-->

Co-authored-by: Jan Monschke <jan.monschke@elastic.co>
Co-authored-by: christineweng <18648970+christineweng@users.noreply.github.com>
hannahbrooks pushed a commit to hannahbrooks/kibana that referenced this pull request Jan 30, 2026
## Summary

I noticed that when generating schemas from yaml files with local
references, the generator will create import statements for the
referenced types.

```yml
openapi: 3.0.1
paths:
  /api/cases:
    post:
      parameters:
        - $ref: '#/components/parameters/kbn_xsrf'
components:
  parameters:
    kbn_xsrf:
      schema:
        type: string
```

Will generate:

```typescript
import {, #/components/parameters/kbn_xsrf' } (...)
```

The fix I am proposing will skip generating import statements for local
references.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release release_note:skip Skip the PR/issue when compiling release notes Team:Cases Security Solution Cases team v8.19.11 v9.1.11 v9.2.5 v9.3.0 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants