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..edc81f78cc 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -1,4 +1,101 @@ { "endpointErrors": {}, - "generalErrors": [] + "generalErrors": [ + "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