NLog / NLog/NLog

NLog schema, XSD won't work for new FilteringWrapper syntax

Open
#3,473 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug XSD change
Dominant language
C#
Stars
6.5k
Forks
1.4k
Avg merge
9h 17m
Merged PRs (30d)
24

Description

related https://github.com/NLog/NLog/issues/3472

after fix, then:

works (no XSD errors):

    <target xsi:type="FilteringWrapper" name="default" >
      <filter xsi:type="whenRepeated" layout="${message}" timeoutSeconds="30" action="Ignore" />
      <filter xsi:type="when"/>
    </target>

works:


    <target xsi:type="FilteringWrapper" name="default" >
      <target xsi:type="Console"  />
    </target>

not working

    <target xsi:type="FilteringWrapper" name="default" >
      <filter xsi:type="whenRepeated" layout="${message}" timeoutSeconds="30" action="Ignore" />
      <filter xsi:type="when"/>

      <target xsi:type="Console"  />
    </target>

he element 'target' in namespace 'http://www.nlog-project.org/schemas/NLog.xsd' has invalid child element 'target' in namespace 'http://www.nlog-project.org/schemas/NLog.xsd'. List of possible elements expected: 'name, condition, filter, optimizeBufferReuse' in namespace 'http://www.nlog-project.org/schemas/NLog.xsd'.

The issue is that in the XSD, it's a "choice":

  <xs:complexType name="FilteringWrapper">
    <xs:complexContent>
      <xs:extension base="WrapperTargetBase">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
          <xs:element name="condition" minOccurs="0" maxOccurs="1" type="Condition" />
          <xs:element name="filter" minOccurs="0" maxOccurs="1" type="Filter" />
          <xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
        </xs:choice>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the XSD definition of the FilteringWrapper complexType shown in the issue and reproduce the three XML validation cases. Update the schema so a FilteringWrapper can contain both filter elements and a nested target, then verify that the previously failing configuration validates without breaking the two working examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.