feat: add completion for additionalProperties propertyName#720
Merged
msivasubramaniaan merged 1 commit intoredhat-developer:mainfrom Jun 8, 2022
Conversation
msivasubramaniaan
approved these changes
Jun 1, 2022
Contributor
msivasubramaniaan
left a comment
There was a problem hiding this comment.
LGTM
Thanks for your contribution
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Add the possibility to have code completion on properties of 'anonymous/unknown' object.
Example:
typescript:
will produce approximately this schema:
then in the yaml it could be complicated for users to guest what can be inside the object
But jsonschema standard allows
propertyNameselement to extend properties json schema docSo by this PR, this schema:
{ "type": "object", "additionalProperties": true, "propertyNames": { "title": "key of obj", "description": "desc", "markdownDescription": "*md description*" } }will produce this result:

Additional notes
Note that
defaultSnippetscan do almost the same:{ "type": "object", "properties": { "prop1": { "type": "string" } }, "additionalProperties": true, "propertyNames": { "title": "key of obj", "description": "desc", "markdownDescription": "*md description*" }, "defaultSnippets": [ { "label": "snippet property", "body": "${1:property}", "suggestionKind": 7, "markdownDescription": "*md description*" } ] }But with
propertyNamesimplementation it will be possible to add some documentation info aboutpattern,min,maxin the future.What issues does this PR fix or reference?
no ref
Is it tested? How?
add UT