From 368c9511ecc9c6f78706474b853bfea97e977a9b Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 11 Aug 2025 16:10:26 +0400 Subject: [PATCH 1/2] Add dangling types to validation-errors.json --- compiler/src/steps/validate-model.ts | 7 ++ output/schema/validation-errors.json | 99 +++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/compiler/src/steps/validate-model.ts b/compiler/src/steps/validate-model.ts index 469a94b79c..d963c57b6a 100644 --- a/compiler/src/steps/validate-model.ts +++ b/compiler/src/steps/validate-model.ts @@ -186,6 +186,13 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma apiModel.endpoints.filter(ep => readyForValidation(ep)).forEach(validateEndpoint) apiModel.endpoints.filter(ep => !readyForValidation(ep)).forEach(validateEndpoint) + // Check types are used + for (const type of apiModel.types) { + if (!typesSeen.has(fqn(type.name))) { + errors.addGeneralError(`Dangling type '${fqn(type.name)}'`) + } + } + // Removes types that we've not seen apiModel.types = apiModel.types.filter(type => typesSeen.has(fqn(type.name))) diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index f6fab219e8..087032aca4 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -1,4 +1,101 @@ { "endpointErrors": {}, - "generalErrors": [] + "generalErrors": [ + "Unused type '_global.scripts_painless_execute:PainlessExecutionPosition'", + "Unused type '_global.scripts_painless_execute:PainlessScript'", + "Unused type '_global.search._types:HitMetadata'", + "Unused type '_global.search._types:SmoothingModel'", + "Unused type '_spec_utils:Setting'", + "Unused type '_types:ActionIds'", + "Unused type '_types:CustomResponseBuilderBase'", + "Unused type '_types:DistanceParsed'", + "Unused type '_types:DynamicResponseBase'", + "Unused type '_types:ElasticsearchResponseBase'", + "Unused type '_types:ElasticsearchUrlFormatter'", + "Unused type '_types:HttpMethod'", + "Unused type '_types:IndexMetrics'", + "Unused type '_types:LatLon'", + "Unused type '_types:LogLevel'", + "Unused type '_types:LongId'", + "Unused type '_types:Transform'", + "Unused type '_types:UnitFloatSeconds'", + "Unused type '_types:Uri'", + "Unused type '_types:UrlParameter'", + "Unused type '_types:VersionNumbers'", + "Unused type '_types:VersionStrings'", + "Unused type '_types.aggregations:AggregationVisitorScope'", + "Unused type '_types.mapping:GeoTree'", + "Unused type '_types.mapping:PropertyWithClrOrigin'", + "Unused type '_types.query_dsl:CharacterType'", + "Unused type '_types.query_dsl:FieldNameQuery'", + "Unused type '_types.query_dsl:GeoFormat'", + "Unused type '_types.query_dsl:Intervals'", + "Unused type '_types.query_dsl:RewriteMultiTerm'", + "Unused type '_types.query_dsl:SpanSubQuery'", + "Unused type '_types.query_dsl:TokenType'", + "Unused type '_types.query_dsl:VisitorScope'", + "Unused type 'cat.transforms:TransformState'", + "Unused type 'cat.transforms:TransformType'", + "Unused type 'cluster.allocation_explain:StoreCopy'", + "Unused type 'cluster.reroute:CommandAction'", + "Unused type 'esql._types:DataPartitioning'", + "Unused type 'ilm._types:Configurations'", + "Unused type 'ilm._types:ForceMergeConfiguration'", + "Unused type 'ilm._types:ShrinkConfiguration'", + "Unused type 'indices._types:Fielddata'", + "Unused type 'indices._types:FielddataFilter'", + "Unused type 'indices._types:FielddataLoading'", + "Unused type 'indices._types:FielddataRegexFilter'", + "Unused type 'indices._types:FielddataSettings'", + "Unused type 'indices._types:GeoPointFielddataFormat'", + "Unused type 'indices._types:IndicesCircuitBreakerSettings'", + "Unused type 'indices._types:IndicesModuleSettings'", + "Unused type 'indices._types:IndicesRecoverySettings'", + "Unused type 'indices._types:OverlappingIndexTemplate'", + "Unused type 'indices._types:StringFielddata'", + "Unused type 'indices._types:StringFielddataFormat'", + "Unused type 'indices.stats:ShardFielddata'", + "Unused type 'inference._types:AmazonSageMakerElasticServiceSettings'", + "Unused type 'inference._types:AmazonSageMakerElasticTaskSettings'", + "Unused type 'inference._types:AmazonSageMakerElementType'", + "Unused type 'inference._types:AmazonSageMakerOpenAiTaskSettings'", + "Unused type 'inference._types:AmazonSageMakerSimilarity'", + "Unused type 'inference._types:EisServiceSettings'", + "Unused type 'inference._types:EisServiceType'", + "Unused type 'inference._types:EisTaskSettings'", + "Unused type 'inference._types:EisTaskType'", + "Unused type 'ingest._types:PipelineFailure'", + "Unused type 'ml._types:CountFunction'", + "Unused type 'ml._types:DistinctCountFunction'", + "Unused type 'ml._types:GeographicFunction'", + "Unused type 'ml._types:InfoContentFunction'", + "Unused type 'ml._types:MetricFunction'", + "Unused type 'ml._types:ModelPlotConfigEnabled'", + "Unused type 'ml._types:NlpInferenceConfigUpdateContainer'", + "Unused type 'ml._types:NlpTokenizationUpdateContainer'", + "Unused type 'ml._types:NonNullSumFunction'", + "Unused type 'ml._types:NonZeroCountFunction'", + "Unused type 'ml._types:RareFunction'", + "Unused type 'ml._types:SumFunction'", + "Unused type 'search_application._types:AnalyticsEvent'", + "Unused type 'transform._types:Sync'", + "Unused type 'watcher._types:Interval'", + "Unused type 'watcher._types:IntervalUnit'", + "Unused type 'watcher._types:JiraAction'", + "Unused type 'watcher._types:JiraIssueAssignee'", + "Unused type 'watcher._types:JiraIssueFields'", + "Unused type 'watcher._types:JiraIssuePriority'", + "Unused type 'watcher._types:JiraIssueProject'", + "Unused type 'watcher._types:JiraIssueReporter'", + "Unused type 'watcher._types:JiraIssueType'", + "Unused type 'watcher._types:PagerDutySentEvent'", + "Unused type 'watcher._types:SimpleInput'", + "Unused type 'watcher._types:SlackActionMessageResult'", + "Unused type 'watcher._types:TriggerEvent'", + "Unused type 'xpack.usage:Alerting'", + "Unused type 'xpack.usage:AlertingExecution'", + "Unused type 'xpack.usage:AlertingInput'", + "Unused type 'xpack.usage:ExecutionAction'", + "Unused type 'xpack.usage:ForecastStatistics'" + ] } \ No newline at end of file From 40bc17dc7d4bce256c3f74a2d5d3fa25df2da5bf Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 11 Aug 2025 16:19:12 +0400 Subject: [PATCH 2/2] Generate validation-errors.json --- output/schema/validation-errors.json | 192 +++++++++++++-------------- 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 087032aca4..edc81f78cc 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -1,101 +1,101 @@ { "endpointErrors": {}, "generalErrors": [ - "Unused type '_global.scripts_painless_execute:PainlessExecutionPosition'", - "Unused type '_global.scripts_painless_execute:PainlessScript'", - "Unused type '_global.search._types:HitMetadata'", - "Unused type '_global.search._types:SmoothingModel'", - "Unused type '_spec_utils:Setting'", - "Unused type '_types:ActionIds'", - "Unused type '_types:CustomResponseBuilderBase'", - "Unused type '_types:DistanceParsed'", - "Unused type '_types:DynamicResponseBase'", - "Unused type '_types:ElasticsearchResponseBase'", - "Unused type '_types:ElasticsearchUrlFormatter'", - "Unused type '_types:HttpMethod'", - "Unused type '_types:IndexMetrics'", - "Unused type '_types:LatLon'", - "Unused type '_types:LogLevel'", - "Unused type '_types:LongId'", - "Unused type '_types:Transform'", - "Unused type '_types:UnitFloatSeconds'", - "Unused type '_types:Uri'", - "Unused type '_types:UrlParameter'", - "Unused type '_types:VersionNumbers'", - "Unused type '_types:VersionStrings'", - "Unused type '_types.aggregations:AggregationVisitorScope'", - "Unused type '_types.mapping:GeoTree'", - "Unused type '_types.mapping:PropertyWithClrOrigin'", - "Unused type '_types.query_dsl:CharacterType'", - "Unused type '_types.query_dsl:FieldNameQuery'", - "Unused type '_types.query_dsl:GeoFormat'", - "Unused type '_types.query_dsl:Intervals'", - "Unused type '_types.query_dsl:RewriteMultiTerm'", - "Unused type '_types.query_dsl:SpanSubQuery'", - "Unused type '_types.query_dsl:TokenType'", - "Unused type '_types.query_dsl:VisitorScope'", - "Unused type 'cat.transforms:TransformState'", - "Unused type 'cat.transforms:TransformType'", - "Unused type 'cluster.allocation_explain:StoreCopy'", - "Unused type 'cluster.reroute:CommandAction'", - "Unused type 'esql._types:DataPartitioning'", - "Unused type 'ilm._types:Configurations'", - "Unused type 'ilm._types:ForceMergeConfiguration'", - "Unused type 'ilm._types:ShrinkConfiguration'", - "Unused type 'indices._types:Fielddata'", - "Unused type 'indices._types:FielddataFilter'", - "Unused type 'indices._types:FielddataLoading'", - "Unused type 'indices._types:FielddataRegexFilter'", - "Unused type 'indices._types:FielddataSettings'", - "Unused type 'indices._types:GeoPointFielddataFormat'", - "Unused type 'indices._types:IndicesCircuitBreakerSettings'", - "Unused type 'indices._types:IndicesModuleSettings'", - "Unused type 'indices._types:IndicesRecoverySettings'", - "Unused type 'indices._types:OverlappingIndexTemplate'", - "Unused type 'indices._types:StringFielddata'", - "Unused type 'indices._types:StringFielddataFormat'", - "Unused type 'indices.stats:ShardFielddata'", - "Unused type 'inference._types:AmazonSageMakerElasticServiceSettings'", - "Unused type 'inference._types:AmazonSageMakerElasticTaskSettings'", - "Unused type 'inference._types:AmazonSageMakerElementType'", - "Unused type 'inference._types:AmazonSageMakerOpenAiTaskSettings'", - "Unused type 'inference._types:AmazonSageMakerSimilarity'", - "Unused type 'inference._types:EisServiceSettings'", - "Unused type 'inference._types:EisServiceType'", - "Unused type 'inference._types:EisTaskSettings'", - "Unused type 'inference._types:EisTaskType'", - "Unused type 'ingest._types:PipelineFailure'", - "Unused type 'ml._types:CountFunction'", - "Unused type 'ml._types:DistinctCountFunction'", - "Unused type 'ml._types:GeographicFunction'", - "Unused type 'ml._types:InfoContentFunction'", - "Unused type 'ml._types:MetricFunction'", - "Unused type 'ml._types:ModelPlotConfigEnabled'", - "Unused type 'ml._types:NlpInferenceConfigUpdateContainer'", - "Unused type 'ml._types:NlpTokenizationUpdateContainer'", - "Unused type 'ml._types:NonNullSumFunction'", - "Unused type 'ml._types:NonZeroCountFunction'", - "Unused type 'ml._types:RareFunction'", - "Unused type 'ml._types:SumFunction'", - "Unused type 'search_application._types:AnalyticsEvent'", - "Unused type 'transform._types:Sync'", - "Unused type 'watcher._types:Interval'", - "Unused type 'watcher._types:IntervalUnit'", - "Unused type 'watcher._types:JiraAction'", - "Unused type 'watcher._types:JiraIssueAssignee'", - "Unused type 'watcher._types:JiraIssueFields'", - "Unused type 'watcher._types:JiraIssuePriority'", - "Unused type 'watcher._types:JiraIssueProject'", - "Unused type 'watcher._types:JiraIssueReporter'", - "Unused type 'watcher._types:JiraIssueType'", - "Unused type 'watcher._types:PagerDutySentEvent'", - "Unused type 'watcher._types:SimpleInput'", - "Unused type 'watcher._types:SlackActionMessageResult'", - "Unused type 'watcher._types:TriggerEvent'", - "Unused type 'xpack.usage:Alerting'", - "Unused type 'xpack.usage:AlertingExecution'", - "Unused type 'xpack.usage:AlertingInput'", - "Unused type 'xpack.usage:ExecutionAction'", - "Unused type 'xpack.usage:ForecastStatistics'" + "Dangling type '_global.scripts_painless_execute:PainlessExecutionPosition'", + "Dangling type '_global.scripts_painless_execute:PainlessScript'", + "Dangling type '_global.search._types:HitMetadata'", + "Dangling type '_global.search._types:SmoothingModel'", + "Dangling type '_spec_utils:Setting'", + "Dangling type '_types:ActionIds'", + "Dangling type '_types:CustomResponseBuilderBase'", + "Dangling type '_types:DistanceParsed'", + "Dangling type '_types:DynamicResponseBase'", + "Dangling type '_types:ElasticsearchResponseBase'", + "Dangling type '_types:ElasticsearchUrlFormatter'", + "Dangling type '_types:HttpMethod'", + "Dangling type '_types:IndexMetrics'", + "Dangling type '_types:LatLon'", + "Dangling type '_types:LogLevel'", + "Dangling type '_types:LongId'", + "Dangling type '_types:Transform'", + "Dangling type '_types:UnitFloatSeconds'", + "Dangling type '_types:Uri'", + "Dangling type '_types:UrlParameter'", + "Dangling type '_types:VersionNumbers'", + "Dangling type '_types:VersionStrings'", + "Dangling type '_types.aggregations:AggregationVisitorScope'", + "Dangling type '_types.mapping:GeoTree'", + "Dangling type '_types.mapping:PropertyWithClrOrigin'", + "Dangling type '_types.query_dsl:CharacterType'", + "Dangling type '_types.query_dsl:FieldNameQuery'", + "Dangling type '_types.query_dsl:GeoFormat'", + "Dangling type '_types.query_dsl:Intervals'", + "Dangling type '_types.query_dsl:RewriteMultiTerm'", + "Dangling type '_types.query_dsl:SpanSubQuery'", + "Dangling type '_types.query_dsl:TokenType'", + "Dangling type '_types.query_dsl:VisitorScope'", + "Dangling type 'cat.transforms:TransformState'", + "Dangling type 'cat.transforms:TransformType'", + "Dangling type 'cluster.allocation_explain:StoreCopy'", + "Dangling type 'cluster.reroute:CommandAction'", + "Dangling type 'esql._types:DataPartitioning'", + "Dangling type 'ilm._types:Configurations'", + "Dangling type 'ilm._types:ForceMergeConfiguration'", + "Dangling type 'ilm._types:ShrinkConfiguration'", + "Dangling type 'indices._types:Fielddata'", + "Dangling type 'indices._types:FielddataFilter'", + "Dangling type 'indices._types:FielddataLoading'", + "Dangling type 'indices._types:FielddataRegexFilter'", + "Dangling type 'indices._types:FielddataSettings'", + "Dangling type 'indices._types:GeoPointFielddataFormat'", + "Dangling type 'indices._types:IndicesCircuitBreakerSettings'", + "Dangling type 'indices._types:IndicesModuleSettings'", + "Dangling type 'indices._types:IndicesRecoverySettings'", + "Dangling type 'indices._types:OverlappingIndexTemplate'", + "Dangling type 'indices._types:StringFielddata'", + "Dangling type 'indices._types:StringFielddataFormat'", + "Dangling type 'indices.stats:ShardFielddata'", + "Dangling type 'inference._types:AmazonSageMakerElasticServiceSettings'", + "Dangling type 'inference._types:AmazonSageMakerElasticTaskSettings'", + "Dangling type 'inference._types:AmazonSageMakerElementType'", + "Dangling type 'inference._types:AmazonSageMakerOpenAiTaskSettings'", + "Dangling type 'inference._types:AmazonSageMakerSimilarity'", + "Dangling type 'inference._types:EisServiceSettings'", + "Dangling type 'inference._types:EisServiceType'", + "Dangling type 'inference._types:EisTaskSettings'", + "Dangling type 'inference._types:EisTaskType'", + "Dangling type 'ingest._types:PipelineFailure'", + "Dangling type 'ml._types:CountFunction'", + "Dangling type 'ml._types:DistinctCountFunction'", + "Dangling type 'ml._types:GeographicFunction'", + "Dangling type 'ml._types:InfoContentFunction'", + "Dangling type 'ml._types:MetricFunction'", + "Dangling type 'ml._types:ModelPlotConfigEnabled'", + "Dangling type 'ml._types:NlpInferenceConfigUpdateContainer'", + "Dangling type 'ml._types:NlpTokenizationUpdateContainer'", + "Dangling type 'ml._types:NonNullSumFunction'", + "Dangling type 'ml._types:NonZeroCountFunction'", + "Dangling type 'ml._types:RareFunction'", + "Dangling type 'ml._types:SumFunction'", + "Dangling type 'search_application._types:AnalyticsEvent'", + "Dangling type 'transform._types:Sync'", + "Dangling type 'watcher._types:Interval'", + "Dangling type 'watcher._types:IntervalUnit'", + "Dangling type 'watcher._types:JiraAction'", + "Dangling type 'watcher._types:JiraIssueAssignee'", + "Dangling type 'watcher._types:JiraIssueFields'", + "Dangling type 'watcher._types:JiraIssuePriority'", + "Dangling type 'watcher._types:JiraIssueProject'", + "Dangling type 'watcher._types:JiraIssueReporter'", + "Dangling type 'watcher._types:JiraIssueType'", + "Dangling type 'watcher._types:PagerDutySentEvent'", + "Dangling type 'watcher._types:SimpleInput'", + "Dangling type 'watcher._types:SlackActionMessageResult'", + "Dangling type 'watcher._types:TriggerEvent'", + "Dangling type 'xpack.usage:Alerting'", + "Dangling type 'xpack.usage:AlertingExecution'", + "Dangling type 'xpack.usage:AlertingInput'", + "Dangling type 'xpack.usage:ExecutionAction'", + "Dangling type 'xpack.usage:ForecastStatistics'" ] } \ No newline at end of file