Skip to content

[9.1] [OpenAPI generator] add transformSchemaName config options (#250857)#252471

Closed
janmonschke wants to merge 1 commit intoelastic:9.1from
janmonschke:backport/9.1/pr-250857
Closed

[9.1] [OpenAPI generator] add transformSchemaName config options (#250857)#252471
janmonschke wants to merge 1 commit intoelastic:9.1from
janmonschke:backport/9.1/pr-250857

Conversation

@janmonschke
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.1:

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:
#	src/platform/packages/shared/kbn-openapi-generator/src/parser/get_generation_context.ts
#	x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/attack_discovery/common_attributes.gen.ts
#	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/actions/response_actions/run_script/run_script.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:56
@elasticmachine
Copy link
Copy Markdown
Contributor

CI was triggered for this PR, but this PR targets 9.1 which should not receive a future release. CI is not supported for these branches. Please consult the release schedule, or contact #kibana-operations if you believe this is an error.

The following branches are currently considered to be open:

  • main
  • 9.3
  • 9.2
  • 8.19

1 similar comment
@elasticmachine
Copy link
Copy Markdown
Contributor

CI was triggered for this PR, but this PR targets 9.1 which should not receive a future release. CI is not supported for these branches. Please consult the release schedule, or contact #kibana-operations if you believe this is an error.

The following branches are currently considered to be open:

  • main
  • 9.3
  • 9.2
  • 8.19

auto-merge was automatically disabled February 10, 2026 12:05

Pull request was closed

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.

2 participants