Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ Tested with .Net framework code generator xsd.exe

Not verified with JAXB.

== Schema regression (libxml2)

`tests/schema/run.sh` validates the VAST 4.4 InLine/Wrapper cardinality fix
(InteractiveAdvertisingBureau/vast#58) with xmllint:

./tests/schema/run.sh

Requires `xmllint` from libxml2. Empty `<InLine/>`, empty `<Wrapper/>`, and
repeated `<AdSystem>` must fail against this tree. The same three documents
still validate against `origin/master` `vast_4.4.xsd`, which is the bug.

== Using xsd.exe from Visual Studio command line

Expand Down
23 changes: 23 additions & 0 deletions tests/schema/accept-minimal-inline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="4.4" xmlns="http://www.iab.com/VAST">
<Ad id="20001">
<InLine>
<AdSystem version="1">iabtechlab</AdSystem>
<Impression id="Impression-ID"><![CDATA[https://example.com/track/impression]]></Impression>
<AdServingId>a532d16d-4d7f-4440-bd29-2ec05553fc80</AdServingId>
<AdTitle>Minimal inline</AdTitle>
<Creatives>
<Creative id="5480" sequence="1" adId="2447226">
<Linear>
<Duration>00:00:16</Duration>
<MediaFiles>
<MediaFile id="5241" delivery="progressive" type="video/mp4" bitrate="2000" width="1280" height="720">
<![CDATA[https://iab-publicfiles.s3.amazonaws.com/vast/VAST-4.0-Short-Intro.mp4]]>
</MediaFile>
</MediaFiles>
</Linear>
</Creative>
</Creatives>
</InLine>
</Ad>
</VAST>
10 changes: 10 additions & 0 deletions tests/schema/accept-minimal-wrapper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="4.4" xmlns="http://www.iab.com/VAST">
<Ad id="wrap-1">
<Wrapper>
<AdSystem version="1">iabtechlab</AdSystem>
<Impression id="Impression-ID"><![CDATA[https://example.com/track/impression]]></Impression>
<VASTAdTagURI><![CDATA[https://example.com/vast/inline.xml]]></VASTAdTagURI>
</Wrapper>
</Ad>
</VAST>
25 changes: 25 additions & 0 deletions tests/schema/accept-nonlinear-pause.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="4.4" xmlns="http://www.iab.com/VAST">
<Ad id="pause-1">
<InLine>
<AdSystem version="1">iabtechlab</AdSystem>
<Impression id="Impression-ID"><![CDATA[https://example.com/track/impression]]></Impression>
<AdServingId>a532d16d-4d7f-4440-bd29-2ec05553fc80</AdServingId>
<AdTitle>CTV pause</AdTitle>
<Creatives>
<Creative id="pause-creative">
<NonLinearAds>
<NonLinear id="pause-nl" width="1920" height="1080">
<Duration>00:00:15</Duration>
<MediaFiles>
<MediaFile delivery="progressive" type="video/mp4" width="1920" height="1080">
<![CDATA[https://iab-publicfiles.s3.amazonaws.com/vast/VAST-4.0-Short-Intro.mp4]]>
</MediaFile>
</MediaFiles>
</NonLinear>
</NonLinearAds>
</Creative>
</Creatives>
</InLine>
</Ad>
</VAST>
4 changes: 4 additions & 0 deletions tests/schema/reject-empty-inline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="4.4" xmlns="http://www.iab.com/VAST">
<Ad id="a"><InLine/></Ad>
</VAST>
4 changes: 4 additions & 0 deletions tests/schema/reject-empty-wrapper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="4.4" xmlns="http://www.iab.com/VAST">
<Ad id="a"><Wrapper/></Ad>
</VAST>
10 changes: 10 additions & 0 deletions tests/schema/reject-repeated-adsystem.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="4.4" xmlns="http://www.iab.com/VAST">
<Ad id="a">
<InLine>
<AdSystem>A</AdSystem>
<AdSystem>B</AdSystem>
<AdSystem>C</AdSystem>
</InLine>
</Ad>
</VAST>
56 changes: 56 additions & 0 deletions tests/schema/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Regression tests for InteractiveAdvertisingBureau/vast#58.
# Empty InLine/Wrapper and repeated AdSystem must fail against this tree's
# vast_4.4.xsd. They still validate against origin/master, which is the bug.
set -euo pipefail

ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
DIR="$(cd "$(dirname "$0")" && pwd)"
XSD="$ROOT/vast_4.4.xsd"
XMLLINT="${XMLLINT:-xmllint}"

if ! command -v "$XMLLINT" >/dev/null 2>&1; then
echo "xmllint not found. Install libxml2-utils." >&2
exit 1
fi

expect_invalid() {
local file="$1"
if "$XMLLINT" --noout --schema "$XSD" "$file" >/dev/null 2>&1; then
echo "FAIL: expected invalid: $(basename "$file")" >&2
exit 1
fi
echo "ok reject $(basename "$file")"
}

expect_valid() {
local file="$1"
if ! "$XMLLINT" --noout --schema "$XSD" "$file" >/dev/null 2>&1; then
echo "FAIL: expected valid: $(basename "$file")" >&2
"$XMLLINT" --noout --schema "$XSD" "$file" || true
exit 1
fi
echo "ok accept $(basename "$file")"
}

expect_invalid "$DIR/reject-empty-inline.xml"
expect_invalid "$DIR/reject-empty-wrapper.xml"
expect_invalid "$DIR/reject-repeated-adsystem.xml"
expect_valid "$DIR/accept-minimal-inline.xml"
expect_valid "$DIR/accept-minimal-wrapper.xml"
expect_valid "$DIR/accept-nonlinear-pause.xml"

if git -C "$ROOT" rev-parse --verify origin/master >/dev/null 2>&1; then
master_xsd="$(mktemp)"
trap 'rm -f "$master_xsd"' EXIT
git -C "$ROOT" show origin/master:vast_4.4.xsd > "$master_xsd"
for file in "$DIR"/reject-empty-inline.xml "$DIR"/reject-empty-wrapper.xml "$DIR"/reject-repeated-adsystem.xml; do
if ! "$XMLLINT" --noout --schema "$master_xsd" "$file" >/dev/null 2>&1; then
echo "FAIL: $(basename "$file") should still validate against origin/master vast_4.4.xsd (the #58 bug)." >&2
exit 1
fi
echo "ok master still accepts $(basename "$file")"
done
fi

echo "vast 4.4 InLine/Wrapper cardinality tests passed."
44 changes: 22 additions & 22 deletions vast_4.4.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -98,36 +98,36 @@
</xs:complexType>

<xs:complexType name="vastInLine_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:sequence>
<xs:element name="AdSystem" type="vastAdSystem_type"/>
<xs:element name="AdTitle" type="vastString_type"/>
<xs:element name="Advertiser" type="vastString_type"/>
<xs:element name="Category" type="vastCategory_type"/>
<xs:element name="Description" type="vastString_type"/>
<xs:element name="Survey" type="vastSurvey_type"/>
<xs:element name="Error" type="vastURIElement_type"/>
<xs:element name="Impression" type="vastImpression_type"/>
<xs:element name="Pricing" type="vastPricing_type"/>
<xs:element name="ViewableImpression" type="vastViewableImpression_type"/>
<xs:element name="AdVerifications" type="vastAdVerifications_type"/>
<xs:element name="Error" type="vastURIElement_type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Extensions" type="vastExtensions_type" minOccurs="0"/>
<xs:element name="Impression" type="vastImpression_type" maxOccurs="unbounded"/>
<xs:element name="Pricing" type="vastPricing_type" minOccurs="0"/>
<xs:element name="ViewableImpression" type="vastViewableImpression_type" minOccurs="0"/>
<xs:element name="AdServingId" type="vastString_type"/>
<xs:element name="AdTitle" type="vastString_type"/>
<xs:element name="AdVerifications" type="vastAdVerifications_type" minOccurs="0"/>
<xs:element name="Advertiser" type="vastString_type" minOccurs="0"/>
<xs:element name="Category" type="vastCategory_type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Creatives" type="vastCreatives_type"/>
<xs:element name="Extensions" type="vastExtensions_type"/>
</xs:choice>
<xs:element name="Description" type="vastString_type" minOccurs="0"/>
<xs:element name="Survey" type="vastSurvey_type" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="vastWrapper_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:sequence>
<xs:element name="AdSystem" type="vastAdSystem_type"/>
<xs:element name="Error" type="vastURIElement_type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Extensions" type="vastExtensions_type" minOccurs="0"/>
<xs:element name="Impression" type="vastImpression_type" maxOccurs="unbounded"/>
<xs:element name="Pricing" type="vastPricing_type" minOccurs="0"/>
<xs:element name="ViewableImpression" type="vastViewableImpression_type" minOccurs="0"/>
<xs:element name="AdVerifications" type="vastAdVerifications_type" minOccurs="0"/>
<xs:element name="Creatives" type="vastCreatives_type" minOccurs="0"/>
<xs:element name="VASTAdTagURI" type="vastURIElement_type"/>
<xs:element name="Error" type="vastURIElement_type"/>
<xs:element name="Impression" type="vastImpression_type"/>
<xs:element name="Pricing" type="vastPricing_type"/>
<xs:element name="ViewableImpression" type="vastViewableImpression_type"/>
<xs:element name="AdVerifications" type="vastAdVerifications_type"/>
<xs:element name="Creatives" type="vastCreatives_type"/>
<xs:element name="Extensions" type="vastExtensions_type"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="followAdditionalWrappers" type="xs:boolean" use="optional"/>
<xs:attribute name="allowMultipleAds" type="xs:boolean" use="optional"/>
<xs:attribute name="fallbackOnNoAd" type="xs:boolean" use="optional"/>
Expand Down