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

Various OAS fleet request fields are incorrectly nullable #197155

Open
daemitus opened this issue Oct 22, 2024 · 0 comments
Open

Various OAS fleet request fields are incorrectly nullable #197155

daemitus opened this issue Oct 22, 2024 · 0 comments
Labels
bug Fixes for quality problems that affect the customer experience needs-team Issues missing a team label

Comments

@daemitus
Copy link

Describe the bug:

As part of upgrading the Terraform elasticstack provider to use the generated OAS docs, various fields were discovered in fleet that are described as nullable, but are in-fact not. These were discovered by running the TF acceptance tests locally. This is probably due to re-use of the response schema as the request schema (or vice-versa, with some minimal changes).

There are likely more, these are just what the acceptance tests caught.

agentPoliciesPath = "/api/fleet/agent_policies"
agentPolicyPath = "/api/fleet/agent_policies/{agentPolicyId}"

// [request body.keep_monitoring_alive]: expected value of type [boolean] but got [null]
agentPoliciesPath Post "requestBody.content.application/json.schema.properties.keep_monitoring_alive"
agentPolicyPath    Put "requestBody.content.application/json.schema.properties.keep_monitoring_alive"

// [request body.supports_agentless]: expected value of type [boolean] but got [null]
agentPoliciesPath Post "requestBody.content.application/json.schema.properties.supports_agentless"
agentPolicyPath.   Put "requestBody.content.application/json.schema.properties.supports_agentless"

// [request body.supports_agentless]: expected value of type [boolean] but got [null]
agentPoliciesPath Post "requestBody.content.application/json.schema.properties.overrides"
agentPolicyPath   Put  "requestBody.content.application/json.schema.properties.overrides"

outputByIdPath = "/api/fleet/outputs/{outputId}"
outputsPath = "/api/fleet/outputs"
// These are generally in each output type POST/PUT request, after I created a $ref entry.
// [request body.1.ca_sha256]: expected value of type [string] but got [null]"
"schemas.new_output_<type>.properties.ca_sha256"
"schemas.update_output_<type>.properties.ca_sha256"

// [request body.1.ca_trusted_fingerprint]: expected value of type [string] but got [null]
"schemas.new_output_%s.properties.ca_trusted_fingerprint"
"schemas.update_output_%s.properties.ca_trusted_fingerprint"

// [request body.0.shipper]: expected a plain object value, but found [null] instead
"schemas.new_output_shipper"
"schemas.new_output_ssl"

// [request body.1.shipper]: expected a plain object value, but found [null] instead
"schemas.update_output_shipper"
"schemas.update_output_ssl"

Steps to reproduce:

curl -u elastic:password http://localhost:5601/api/fleet/outputs -H 'Kbn-Xsrf: true' --json '{"type": "elasticsearch", "name": "testing", "hosts": ["http://localhost:9200"], "shipper": null}'
{"statusCode":400,"error":"Bad Request","message":"[request body]: types that failed validation:\n- [request body.0.shipper]: expected a plain object value, but found [null] instead.\n- [request body.1.shipper]: expected a plain object value, but found [null] instead.\n- [request body.2.shipper]: expected a plain object value, but found [null] instead.\n- [request body.3.shipper]: expected a plain object value, but found [null] instead."}%

Expected behavior:
If truly nullable, no errors. Otherwise OAS should show optional, not nullable for each POST/PUT request.

@daemitus daemitus added the bug Fixes for quality problems that affect the customer experience label Oct 22, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience needs-team Issues missing a team label
Projects
None yet
Development

No branches or pull requests

1 participant