chore: optional descriptors for language and species
This commit is contained in:
parent
f52a6c5b68
commit
8b73535396
4 changed files with 9 additions and 9 deletions
|
|
@ -7,7 +7,7 @@
|
|||
<xs:element name="language" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="description" type="xs:string" />
|
||||
<xs:element name="description" type="xs:string" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:string" use="required" />
|
||||
<xs:attribute name="name" type="xs:string" use="required" />
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<xs:element name="species">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="description" type="xs:string" />
|
||||
<xs:element name="description" type="xs:string" minOccurs="0" />
|
||||
<xs:element name="languages" type="refList" />
|
||||
<xs:element name="citizenships" type="refList" />
|
||||
<xs:element name="subspecies" minOccurs="0">
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<xs:element name="entry" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="description" type="xs:string" />
|
||||
<xs:element name="description" type="xs:string" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:string" use="required" />
|
||||
<xs:attribute name="name" type="xs:string" use="required" />
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ export function parseSpecies(xml: string): SpeciesData {
|
|||
return {
|
||||
id: root['@_id'],
|
||||
name: root['@_name'],
|
||||
description: root.description.trim(),
|
||||
description: root.description?.trim(),
|
||||
subspeciesLabel: root['@_subspeciesLabel'],
|
||||
languages: extractRefs(root.languages),
|
||||
citizenships: extractRefs(root.citizenships),
|
||||
subspecies: subspecies.map((e: any) => ({
|
||||
id: e['@_id'],
|
||||
name: e['@_name'],
|
||||
description: e.description.trim()
|
||||
description: e.description?.trim()
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ export function parseLanguages(xml: string): LanguageData[] {
|
|||
return root.language.map((l: any) => ({
|
||||
id: l['@_id'],
|
||||
name: l['@_name'],
|
||||
description: l.description.trim()
|
||||
description: l.description?.trim()
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
export interface SpeciesData {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
description?: string;
|
||||
subspeciesLabel: string;
|
||||
subspecies: { id: string; name: string; description: string }[];
|
||||
subspecies: { id: string; name: string; description?: string }[];
|
||||
languages: string[];
|
||||
citizenships: string[];
|
||||
}
|
||||
|
|
@ -17,5 +17,5 @@ export interface CitizenshipData {
|
|||
export interface LanguageData {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
description?: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue