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

Feature: add conditional requirements for properties #155

Closed

Conversation

EmilyGraceSeville7cf
Copy link
Collaborator

@EmilyGraceSeville7cf EmilyGraceSeville7cf commented Apr 20, 2023

  • auth is required to be present when auth_zone is used
  • auth is required to be string when auth_zone is used
  • auth value changed to admin:s3cr3t while default is mentioned in comment above

@EmilyGraceSeville7cf EmilyGraceSeville7cf self-assigned this Apr 20, 2023
@EmilyGraceSeville7cf EmilyGraceSeville7cf changed the title Feature: add conditional requirenments for properties Feature: add conditional requirements for properties Apr 20, 2023
@EmilyGraceSeville7cf EmilyGraceSeville7cf marked this pull request as draft April 20, 2023 09:45
@EmilyGraceSeville7cf EmilyGraceSeville7cf marked this pull request as ready for review April 20, 2023 09:46
@DannyBen
Copy link
Owner

DannyBen commented Apr 20, 2023

I still prefer to allow having auth_zone in the config regardless of if auth is present or not.
It does not hurt. Validation needs to help, not get in the way.

@DannyBen
Copy link
Owner

And the change to the madness config template is also not in line with my policy for it:

# These are the default configuration values

@EmilyGraceSeville7cf
Copy link
Collaborator Author

EmilyGraceSeville7cf commented Apr 20, 2023

It does not hurt. Validation needs to help, not get in the way.

I think we have different definitions of help. For me, it's aggressive error reporting for everything and denial of almost all errors or mistakes (not fatal errors, but what can make config files dirty if are not addressed). Also, I think that validating configs with defaults is not the best idea because defaults can conflict when considered together. For that reason, I suggest performing validation over any other config. It relates not to just this project, but in general for all ones.

My point is that user should be familiarized with such error (when auth is required). Maybe it's done not via JSON schema, but via some kind of warning like 'auth' string value is required if authentication is needed. And such warning always can be disabled.

And also there is another question: when we prefer silently ignore some properties, and when report error that they are missing? Just to clarify what you want. BTW, maybe it's possible to explain anywhere how to enable aggressive error reporting in JSON schema like I did in this PR. Something like "if you (end user) wanna more error reporting, then you can copy and modify JSON schema like this:".

@DannyBen
Copy link
Owner

DannyBen commented Apr 20, 2023

No. It is not an error to have auth_zone in the configuration. It just specifies what would be the name of the auth zone, if auth is enabled.

The configuration file is not code. It intends to specify the user's preferences.

Imagine a user having multiple madness sites, with auth_zone: My Company's Documentation, and auth just enabled in some cases.

And also there is another question: when we prefer silently ignore some properties and when report error that they are missing? Just to clarify what you want.

Not sure I am following.
All properties are optional. You can run madness without any config file, which means that all should accept null, and none are required.

@DannyBen DannyBen deleted the feature/add-dependencies-to-json-schema branch June 19, 2024 18:02
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.

2 participants