Skip to content

[9.2] [OpenAPI generator] add transformSchemaName config options (#250857)#252468

Merged
janmonschke merged 2 commits intoelastic:9.2from
janmonschke:backport/9.2/pr-250857
Feb 10, 2026
Merged

[9.2] [OpenAPI generator] add transformSchemaName config options (#250857)#252468
janmonschke merged 2 commits intoelastic:9.2from
janmonschke:backport/9.2/pr-250857

Conversation

@janmonschke
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.2:

Questions ?

Please refer to the Backport tool documentation

…#250857)

## Summary

If a yaml definition defines the type names in lowercase, like in the
cases codebase, the generator would generate lowercase type/schema
names. This is against our eslint rules.

```yaml
in: query
name: assignees
description: >
  Filters the returned cases by assignees.
  Valid values are `none` or unique identifiers for the user profiles.
  These identifiers can be found by using the suggest user profile API.
```

would generate:

```ts
export type assignees = z.infer<typeof assignees>; // <-- ESLint error
export const assignees = z.array(...)
```

This PR adds a transformSchemaName option that allows to transform the
schema names to `PascalCase`.

That allows us to generate the correct schema names without having to
touch the API documentation yaml files.

This is the code that is generated with `transformSchemaName` set to
`pascalCase`.

```ts
export type Assignees = z.infer<typeof Assignees>;
export const Assignees = z.array(...)
```

For now `transformSchemaName` only supports `pascalCase` but it can be
extended in the future.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
(cherry picked from commit cb8b556)

# Conflicts:
#	x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common/api/model/exception_list_common.gen.ts
#	x-pack/solutions/security/plugins/security_solution/common/api/endpoint/actions/file_download/file_download.gen.ts
#	x-pack/solutions/security/plugins/security_solution/common/api/endpoint/actions/file_info/file_info.gen.ts
#	x-pack/solutions/security/plugins/security_solution/common/api/endpoint/model/schema/common.gen.ts
#	x-pack/solutions/security/plugins/security_solution/common/api/entity_analytics/monitoring/monitoring_entity_source/monitoring_entity_source.gen.ts
@janmonschke janmonschke added the backport This PR is a backport of another PR label Feb 10, 2026
@janmonschke janmonschke enabled auto-merge (squash) February 10, 2026 09:52
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Unknown metric groups

API count

id before after diff
@kbn/openapi-generator 15 16 +1

History

@janmonschke janmonschke merged commit d66cce0 into elastic:9.2 Feb 10, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants