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

Optionally enforce required elements in XSDs #263

Merged

Conversation

kwin
Copy link
Contributor

@kwin kwin commented Oct 18, 2022

This closes #162

@sonatype-lift
Copy link

sonatype-lift bot commented Oct 18, 2022

⚠️ 14 God Classes were detected by Lift in this project. Visit the Lift web console for more details.

* @since 2.1.0
*/
@Parameter( defaultValue = "true")
private boolean areMandatoryElementsNotEnforced;
Copy link
Member

Choose a reason for hiding this comment

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

This does not look very usual to have a boolean property starting with is or are.
Usually, the getters are written isXxx but the field is most often named without the is/are prefix.
I would propose to invert it and name it enforceMandatoryElements and default it to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can rename but the default should be to enforce mandatory elements. The POM case is really an unusual edge case IMHO

Copy link
Member

Choose a reason for hiding this comment

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

I may have missed something, but the current default value is true for not enforcing mandatory elements. I'm fine with changing the default value though.

Copy link
Member

Choose a reason for hiding this comment

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

The javadoc should be changed accordingly if the default value is to be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, my bad. I will think again about defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed as you proposed @gnodet in 9ba65d8.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lets start with the default being no enforcement for backwards-compatibility.

@kwin kwin merged commit e98cde5 into codehaus-plexus:master Dec 29, 2022
@kwin kwin deleted the optionally-enforce-required-elements-in-xsd branch December 29, 2022 10:07
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.

Required fields lead to non required element in XSD
4 participants