Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore missing query parameters in fleet rest-api-spec #3166

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,6 @@ dist/* binary
### Linguist Overrides #############################################################################

output/** linguist-generated=true
output/schema/validation-errors.json linguist-generated=false

####################################################################################################
3 changes: 2 additions & 1 deletion compiler/src/steps/validate-rest-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export default async function validateRestSpec (model: model.Model, jsonSpec: Ma
}
}

if (spec.params != null) {
// fleet API are deliberately undocumented in rest-api-spec)
if (spec.params != null && !endpoint.name.startsWith('fleet.')) {
const params = Object.keys(spec.params)
const queryProperties = requestProperties.query.map(property => property.name)
// are all the parameters in the request definition present in the json spec?
Expand Down
63 changes: 1 addition & 62 deletions output/schema/validation-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -641,21 +641,7 @@
"response": []
},
"fleet.msearch": {
"request": [
"Request: query parameter 'allow_no_indices' does not exist in the json spec",
"Request: query parameter 'ccs_minimize_roundtrips' does not exist in the json spec",
"Request: query parameter 'expand_wildcards' does not exist in the json spec",
"Request: query parameter 'ignore_throttled' does not exist in the json spec",
"Request: query parameter 'ignore_unavailable' does not exist in the json spec",
"Request: query parameter 'max_concurrent_searches' does not exist in the json spec",
"Request: query parameter 'max_concurrent_shard_requests' does not exist in the json spec",
"Request: query parameter 'pre_filter_shard_size' does not exist in the json spec",
"Request: query parameter 'search_type' does not exist in the json spec",
"Request: query parameter 'rest_total_hits_as_int' does not exist in the json spec",
"Request: query parameter 'typed_keys' does not exist in the json spec",
"Request: query parameter 'wait_for_checkpoints' does not exist in the json spec",
"Request: query parameter 'allow_partial_search_results' does not exist in the json spec"
],
"request": [],
"response": [
"type_alias definition _global.msearch:ResponseItem / union_of / instance_of / Generics / instance_of - No type definition for '_global.msearch.ResponseItem:TDocument'"
]
Expand All @@ -666,53 +652,6 @@
],
"response": []
},
"fleet.search": {
"request": [
"Request: query parameter 'allow_no_indices' does not exist in the json spec",
"Request: query parameter 'analyzer' does not exist in the json spec",
"Request: query parameter 'analyze_wildcard' does not exist in the json spec",
"Request: query parameter 'batched_reduce_size' does not exist in the json spec",
"Request: query parameter 'ccs_minimize_roundtrips' does not exist in the json spec",
"Request: query parameter 'default_operator' does not exist in the json spec",
"Request: query parameter 'df' does not exist in the json spec",
"Request: query parameter 'docvalue_fields' does not exist in the json spec",
"Request: query parameter 'expand_wildcards' does not exist in the json spec",
"Request: query parameter 'explain' does not exist in the json spec",
"Request: query parameter 'ignore_throttled' does not exist in the json spec",
"Request: query parameter 'ignore_unavailable' does not exist in the json spec",
"Request: query parameter 'lenient' does not exist in the json spec",
"Request: query parameter 'max_concurrent_shard_requests' does not exist in the json spec",
"Request: query parameter 'preference' does not exist in the json spec",
"Request: query parameter 'pre_filter_shard_size' does not exist in the json spec",
"Request: query parameter 'request_cache' does not exist in the json spec",
"Request: query parameter 'routing' does not exist in the json spec",
"Request: query parameter 'scroll' does not exist in the json spec",
"Request: query parameter 'search_type' does not exist in the json spec",
"Request: query parameter 'stats' does not exist in the json spec",
"Request: query parameter 'stored_fields' does not exist in the json spec",
"Request: query parameter 'suggest_field' does not exist in the json spec",
"Request: query parameter 'suggest_mode' does not exist in the json spec",
"Request: query parameter 'suggest_size' does not exist in the json spec",
"Request: query parameter 'suggest_text' does not exist in the json spec",
"Request: query parameter 'terminate_after' does not exist in the json spec",
"Request: query parameter 'timeout' does not exist in the json spec",
"Request: query parameter 'track_total_hits' does not exist in the json spec",
"Request: query parameter 'track_scores' does not exist in the json spec",
"Request: query parameter 'typed_keys' does not exist in the json spec",
"Request: query parameter 'rest_total_hits_as_int' does not exist in the json spec",
"Request: query parameter 'version' does not exist in the json spec",
"Request: query parameter '_source' does not exist in the json spec",
"Request: query parameter '_source_excludes' does not exist in the json spec",
"Request: query parameter '_source_includes' does not exist in the json spec",
"Request: query parameter 'seq_no_primary_term' does not exist in the json spec",
"Request: query parameter 'q' does not exist in the json spec",
"Request: query parameter 'size' does not exist in the json spec",
"Request: query parameter 'from' does not exist in the json spec",
"Request: query parameter 'sort' does not exist in the json spec",
"Request: missing json spec query parameter 'wait_for_checkpoints_timeout'"
],
"response": []
},
"get_source": {
"request": [
"Request: query parameter 'stored_fields' does not exist in the json spec"
Expand Down