Skip to content

Required fields lead to non required element in XSDΒ #162

Closed

Description

@kwin

E.g. the required field prefix from https://github.com/apache/maven/blob/master/maven-repository-metadata/src/main/mdo/metadata.mdo#L354-L360 leads to this XSD:

<xs:element minOccurs="0" name="prefix" type="xs:string">

Obsviously the element with name prefix must leave out minOccurs="0" to be required in the XMLs.

Activity

  1. michael-o commented on Jan 9, 2022

    @michael-o
    Member

    Please link the spot in question. I have provided it in the JIRA issue.

  2. kwin commented on Jan 9, 2022

    @kwin
    ContributorAuthor

    This seems to be caused by

    // Usually, would only do this if the field is not "required", but due to inheritance, it may be
    // present, even if not here, so we need to let it slide
    w.addAttribute( "minOccurs", "0" );
    .

  3. kwin commented on Oct 18, 2022

    @kwin
    ContributorAuthor

    The reason for this behaviour seems to be driven by pom.xml specifics, i.e. POMs are merged with their parents before they need to be valid. As this is definitely an edge case Modello should have a flag for enabling/disabling that behaviour.
    By default it is reasonable to assume that the XML is not requiring post-processing before validating it against the schema.

  4. michael-o commented on Oct 18, 2022

    @michael-o
    Member

    The reason for this behaviour seems to be driven by pom.xml specifics, i.e. POMs are merged with their parents before they need to be valid. As this is definitely an edge case Modello should have a flag for enabling/disabling that behaviour. By default it is reasonable to assume that the XML is not requiring post-processing before validating it against the schema.

    I fully agree with that.

  5. added a commit that references this issue on Oct 18, 2022
    c24cf75
  6. added a commit that references this issue on Dec 29, 2022
    e98cde5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions