Skip to content

Commit 661e1b0

Browse files
committed
chore: add eslint rule no-duplicate-class-names
1 parent 4d3b72e commit 661e1b0

File tree

11 files changed

+592
-148
lines changed

11 files changed

+592
-148
lines changed

output/openapi/elasticsearch-openapi.json

Lines changed: 27 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 27 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 39 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/validation-errors.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"endpointErrors": {},
33
"generalErrors": [
4-
"ResponseBody is present in multiple namespaces: _global.search and ml.evaluate_data_frame",
54
"Dangling type '_global.scripts_painless_execute:PainlessExecutionPosition'",
65
"Dangling type '_global.scripts_painless_execute:PainlessScript'",
76
"Dangling type '_global.search._types:HitMetadata'",

output/typescript/types.ts

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/eslint.config.js

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,64 @@ export default defineConfig({
3939
'es-spec-validator/request-must-have-urls': 'error',
4040
'es-spec-validator/no-variants-on-responses': 'error',
4141
'es-spec-validator/no-inline-unions': 'error',
42-
'es-spec-validator/prefer-tagged-variants': 'error'
42+
'es-spec-validator/prefer-tagged-variants': 'error',
43+
'es-spec-validator/no-duplicate-type-names': [
44+
'error',
45+
{
46+
ignoreNames: ['Request', 'Response', 'ResponseBase'],
47+
existingDuplicates: {
48+
Action: [
49+
'indices.modify_data_stream',
50+
'indices.update_aliases',
51+
'watcher._types'
52+
],
53+
Actions: ['ilm._types', 'security.put_privileges', 'watcher._types'],
54+
ComponentTemplate: ['cat.component_templates', 'cluster._types'],
55+
Context: [
56+
'_global.get_script_context',
57+
'_global.search._types',
58+
'nodes._types'
59+
],
60+
DatabaseConfigurationMetadata: [
61+
'ingest.get_geoip_database',
62+
'ingest.get_ip_location_database'
63+
],
64+
Datafeed: ['ml._types', 'xpack.usage'],
65+
Destination: ['_global.reindex', 'transform._types'],
66+
Feature: ['features._types', 'indices.get', 'xpack.info'],
67+
Features: ['indices.get', 'xpack.info'],
68+
Filter: ['_global.termvectors', 'ml._types'],
69+
IndexingPressure: ['cluster.stats', 'indices._types', 'nodes._types'],
70+
IndexingPressureMemory: [
71+
'cluster.stats',
72+
'indices._types',
73+
'nodes._types'
74+
],
75+
Ingest: ['ingest._types', 'nodes._types'],
76+
MigrationFeature: [
77+
'migration.get_feature_upgrade_status',
78+
'migration.post_feature_upgrade'
79+
],
80+
Operation: ['_global.mget', '_global.mtermvectors'],
81+
Phase: ['ilm._types', 'xpack.usage'],
82+
Phases: ['ilm._types', 'xpack.usage'],
83+
Pipeline: ['ingest._types', 'logstash._types'],
84+
Policy: ['enrich._types', 'ilm._types', 'slm._types'],
85+
RequestItem: ['_global.msearch', '_global.msearch_template'],
86+
ResponseItem: ['_global.bulk', '_global.mget', '_global.msearch'],
87+
RoleMapping: ['security._types', 'xpack.usage'],
88+
RuntimeFieldTypes: ['cluster.stats', 'xpack.usage'],
89+
ShardsStats: ['indices.field_usage_stats', 'snapshot._types'],
90+
ShardStats: ['ccr._types', 'indices.stats'],
91+
Source: ['_global.reindex', 'transform._types'],
92+
Token: [
93+
'_global.termvectors',
94+
'security.authenticate',
95+
'security.create_service_token',
96+
'security.enroll_kibana'
97+
]
98+
}
99+
}
100+
]
43101
}
44102
})

specification/ml/evaluate_data_frame/MlEvaluateDataFrameResponse.ts

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,20 @@ import {
2424
} from './types'
2525

2626
export class Response {
27-
/** @codegen_name result */
28-
body: ResponseBody
29-
}
30-
31-
/** @variants container */
32-
export class ResponseBody {
33-
/**
34-
* Evaluation results for a classification analysis.
35-
* It outputs a prediction that identifies to which of the classes each document belongs.
36-
*/
37-
classification?: DataframeClassificationSummary
38-
/**
39-
* Evaluation results for an outlier detection analysis.
40-
* It outputs the probability that each document is an outlier.
41-
*/
42-
outlier_detection?: DataframeOutlierDetectionSummary
43-
/**
44-
* Evaluation results for a regression analysis which outputs a prediction of values.
45-
*/
46-
regression?: DataframeRegressionSummary
27+
body: {
28+
/**
29+
* Evaluation results for a classification analysis.
30+
* It outputs a prediction that identifies to which of the classes each document belongs.
31+
*/
32+
classification?: DataframeClassificationSummary
33+
/**
34+
* Evaluation results for an outlier detection analysis.
35+
* It outputs the probability that each document is an outlier.
36+
*/
37+
outlier_detection?: DataframeOutlierDetectionSummary
38+
/**
39+
* Evaluation results for a regression analysis which outputs a prediction of values.
40+
*/
41+
regression?: DataframeRegressionSummary
42+
}
4743
}

validator/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ It is configured [in the specification directory](../specification/eslint.config
99
|---------------------------------------| - |
1010
| `single-key-dictionary-key-is-string` | `SingleKeyDictionary` keys must be strings. |
1111
| `dictionary-key-is-string` | `Dictionary` keys must be strings. |
12-
| `no-native-types` | TypeScript native utility types (`Record`, `Partial`, etc.) and collection types (`Map`, `Set`, etc.) are not allowed. Use spec-defined aliases like `Dictionary` instead. |
12+
| `no-native-types` | `Typescript native types not allowed, use aliases. |
1313
| `invalid-node-types` | The spec uses a subset of TypeScript, so some types, clauses and expressions are not allowed. |
1414
| `no-generic-number` | Generic `number` type is not allowed outside of `_types/Numeric.ts`. Use concrete numeric types like `integer`, `long`, `float`, `double`, etc. |
1515
| `request-must-have-urls` | All Request interfaces extending `RequestBase` must have a `urls` property defining their endpoint paths and HTTP methods. |
1616
| `no-variants-on-responses` | `@variants` is only supported on Interface types, not on Request or Response classes. Use value_body pattern with `@codegen_name` instead. |
1717
| `no-inline-unions` | Inline union types (e.g., `field: A \| B`) are not allowed in properties/fields. Define a named type alias instead to improve code generation for statically-typed languages. |
1818
| `prefer-tagged-variants` | Union of class types should use tagged variants (`@variants internal` or `@variants container`) instead of inline unions for better deserialization support in statically-typed languages. |
19+
| `no-duplicate-type-names` | All types must be unique across class and enum definitions. |
1920

2021
## Usage
2122

0 commit comments

Comments
 (0)