Skip to content

Conversation

@DannyBen
Copy link
Member

@DannyBen DannyBen commented Aug 26, 2023

cc #426

  • The ConfigValidator now ignores hash keys that start with x-
  • The JSON schema now allows x- keys in all the primary objects.

@EmilySeville7cfg - can you verify this is the best way to allow x-anything? I only added it in several places, assuming there is no way to allow it everywhere.

@DannyBen DannyBen changed the title Allow arbitrary (x-anything) values in bashly.yml Allow arbitrary (x-anything) keys in bashly.yml Aug 26, 2023
},
"additionalProperties": false
"additionalProperties": false,
"patternProperties": { "^x-": {} }
Copy link
Collaborator

@EmilyGraceSeville7cf EmilyGraceSeville7cf Aug 26, 2023

Choose a reason for hiding this comment

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

Suggested change
"patternProperties": { "^x-": {} }
"patternProperties": { "^x-.": { "description": "Custom property" } }

It's better to use . not to allow properties consisting of just prefix x-. Also, we can provide hint saying that this is a custom property.

Can you provide any useful example values for these custom properties? I think we can make them even more user-friendly from Intellisence perpective. ;)

Copy link
Member Author

@DannyBen DannyBen Aug 26, 2023

Choose a reason for hiding this comment

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

Oh - I see now the change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I have updated the regex, feel free to push to this branch with your updates.

Example would be providing another "help" for a command, flag or arg, that will be used for man page generation:

commands: - name: status help: Show status x-manpage-help: |-  This command shows the status of all `images`, `containers` and `volumes`.  Use with `--verbose` to see deleted containers.
@EmilyGraceSeville7cf
Copy link
Collaborator

Everything is ready. :)

@DannyBen
Copy link
Member Author

Can you approve?
I will probably change the example. If you feel it must be there, then maybe the word "anything" or "..." - anything else is confusing.

@DannyBen DannyBen merged commit 5d646db into master Aug 26, 2023
@DannyBen DannyBen deleted the add/arbitrary-config-values branch August 26, 2023 13:33
@DannyBen
Copy link
Member Author

Excellent - thanks for the help.

I will change the example and probably change it to be x_ and not x- - it is easier then for users to request the property by calling command.x_anything.

@EmilyGraceSeville7cf
Copy link
Collaborator

Yep, I agree, underscore maybe a better alternative, to keep all property names consistent - without dashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants