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

json spec: allow null for documentation url #55749

Merged
merged 10 commits into from
May 12, 2020

Conversation

jakelandis
Copy link
Contributor

This commit allows the JSON schema's documentation.url property to have a null value.
This can useful for cases where a feature is under development, and does not have
documentation published yet.

Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments

@@ -130,7 +130,7 @@
"additionalProperties": false,
"properties": {
"url": {
"type": "string",
"type": ["string", "null"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the use of null be constrained only to APIs that have stability beta or experimental? This would align with APIs that are under development, whilst still providing benefit of having links for stable APIs

Copy link
Contributor Author

@jakelandis jakelandis Apr 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the null conditional. So that only stable requires a string, the others (beta, experimental, and private) now allow null. 0b37977

As you pointed out below, this does indeed cause a validation error on the two ml specs below we will need to sort out first.

@@ -119,6 +119,4 @@ validateRestSpec {
ignore 'autoscaling.delete_autoscaling_policy.json'
ignore 'autoscaling.get_autoscaling_policy.json'
ignore 'autoscaling.put_autoscaling_policy.json'
ignore 'ml.validate.json'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are stable APIs, so would clash with the previous comment about allowing null only for beta and experimental APIs. Perhaps we can link to ML jobs documentation for these specs for now? For example,

https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html

@jakelandis
Copy link
Contributor Author

@elastic/machine-learning - Is there any public documentation for /_ml/anomaly_detectors/_validate or /_ml/anomaly_detectors/_validate/detector ? Given the options of "stable", "beta", "experimental", "private" which you choose to describe these APIs ?

@droberts195
Copy link
Contributor

Is there any public documentation for /_ml/anomaly_detectors/_validate or /_ml/anomaly_detectors/_validate/detector ?

No. There's no HLRC either. If I remember correctly the thinking was that they weren't as useful as the job validation that the ML UI does, so we didn't want to encourage people to use them. Officially they don't exist.

Given the options of "stable", "beta", "experimental", "private" which you choose to describe these APIs ?

Given the above I guess they have to be "private". Will that mean none of the language clients include them? That would match the lack of HLRC.

If having spec files is causing too many problems we could just delete the spec files altogether.

@jakelandis
Copy link
Contributor Author

thanks @droberts195, I changed the stability to 'private' and the validation should pass now with the conditional to allow null documentation.

@russcam - not sure about the passivity for changing this to private. Any concerns from the client side ? Also, you may want to spot check that the conditional works correctly with what ever the clients are using to validate the spec. I am not 100% sure that merging of definitions from two places is fully part of the schema validation spec.

@jakelandis
Copy link
Contributor Author

@elasticmachine update branch

@jakelandis
Copy link
Contributor Author

@elasticmachine update branch

@jakelandis
Copy link
Contributor Author

Test failures are related: java.lang.IllegalArgumentException: No enum constant org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestApi.Stability.PRIVATE It looks like we don't support private stability in the test runner. I will fix with this PR (tomorrow).

@russcam
Copy link
Contributor

russcam commented May 12, 2020

Test failures are related: java.lang.IllegalArgumentException: No enum constant org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestApi.Stability.PRIVATE It looks like we don't support private stability in the test runner. I will fix with this PR (tomorrow

My apologies @jakelandis; the "private" stability was discussed but not implemented in the end, so the schema needs to be updated to remove it as an option. #56104 is looking to introduce a "visibility" property that had a notion of a "private" API.

Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left some suggestions that would allow us to move forward with this.

The allowed types for Documentation based on stability looks good.

@jakelandis
Copy link
Contributor Author

Thanks @russcam - I have applied the suggestions.

Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jakelandis jakelandis merged commit 525522e into elastic:master May 12, 2020
@jakelandis jakelandis deleted the null_doc_url branch May 12, 2020 17:51
jakelandis added a commit to jakelandis/elasticsearch that referenced this pull request May 12, 2020
This commit allows the JSON schema's documentation.url property to have a null value.
This can useful for cases where a feature is under development, and does not have
documentation published yet.

This commit also adds a documentation.url for two ml resources.
jakelandis added a commit to jakelandis/elasticsearch that referenced this pull request May 12, 2020
This commit allows the JSON schema's documentation.url property to have a null value.
This can useful for cases where a feature is under development, and does not have
documentation published yet.

This commit also adds a documentation.url for two ml resources.
jakelandis added a commit to jakelandis/elasticsearch that referenced this pull request May 12, 2020
This commit allows the JSON schema's documentation.url property to have a null value.
This can useful for cases where a feature is under development, and does not have
documentation published yet.

This commit also adds a documentation.url for two ml resources.
jakelandis added a commit that referenced this pull request May 12, 2020
This commit allows the JSON schema's documentation.url property to have a null value.
This can useful for cases where a feature is under development, and does not have
documentation published yet.

This commit also adds a documentation.url for two ml resources.
jakelandis added a commit that referenced this pull request May 12, 2020
This commit allows the JSON schema's documentation.url property to have a null value.
This can useful for cases where a feature is under development, and does not have
documentation published yet.

This commit also adds a documentation.url for two ml resources.
jakelandis added a commit that referenced this pull request May 12, 2020
This commit allows the JSON schema's documentation.url property to have a null value.
This can useful for cases where a feature is under development, and does not have
documentation published yet.

This commit also adds a documentation.url for two ml resources.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants