@@ -6,14 +6,15 @@ export const getParameterXML = (
6
6
) => {
7
7
let parameterXML = "" ;
8
8
if ( ! parameter ) return parameterXML ;
9
+
9
10
if ( parameter . type === "simple" ) {
10
- parameterXML = `<ids: simpleValue>${ parameter . parameter } </ids: simpleValue>` ;
11
+ parameterXML = `<simpleValue>${ parameter . parameter } </simpleValue>` ;
11
12
}
12
13
13
14
if ( parameter . type === "enumeration" ) {
14
15
const value = parameter . parameter ;
15
16
parameterXML = `<xs:restriction base="xs:string">
16
- ${ value . map ( ( v ) => `<xs:enumeration value="${ v } " />` ) . join ( "\r\ n" ) }
17
+ ${ value . map ( ( v ) => `<xs:enumeration value="${ v } " />` ) . join ( "\n" ) }
17
18
</xs:restriction>` ;
18
19
}
19
20
@@ -24,9 +25,51 @@ export const getParameterXML = (
24
25
</xs:restriction>` ;
25
26
}
26
27
27
- const xml = `<ids:${ name [ 0 ] . toLowerCase ( ) + name . slice ( 1 ) } >
28
+ if ( parameter . type === "bounds" ) {
29
+ const { min, minInclusive, max, maxInclusive } = parameter . parameter ;
30
+ let minTag = "" ;
31
+ if ( min !== undefined ) {
32
+ minTag = `<xs:min${ minInclusive ? "Inclusive" : "Exclusive" } value="${ min } ">` ;
33
+ }
34
+
35
+ let maxTag = "" ;
36
+ if ( max !== undefined ) {
37
+ maxTag = `<xs:max${ maxInclusive ? "Inclusive" : "Exclusive" } value="${ max } ">` ;
38
+ }
39
+
40
+ parameterXML = `<xs:restriction base="xs:double">
41
+ ${ minTag }
42
+ ${ maxTag }
43
+ </xs:restriction>` ;
44
+ }
45
+
46
+ if ( parameter . type === "length" ) {
47
+ const { length, min, max } = parameter . parameter ;
48
+ let lengthTag = "" ;
49
+ if ( length !== undefined && min === undefined && max === undefined ) {
50
+ lengthTag = `<xs:length value="${ length } " />` ;
51
+ }
52
+
53
+ let minTag = "" ;
54
+ if ( min !== undefined && length === undefined ) {
55
+ minTag = `<xs:minLength value="${ min } " />` ;
56
+ }
57
+
58
+ let maxTag = "" ;
59
+ if ( max !== undefined && length === undefined ) {
60
+ maxTag = `<xs:maxLength value="${ max } " />` ;
61
+ }
62
+
63
+ parameterXML = `<xs:restriction base="xs:string">
64
+ ${ lengthTag }
65
+ ${ minTag }
66
+ ${ maxTag }
67
+ </xs:restriction>` ;
68
+ }
69
+
70
+ const xml = `<${ name [ 0 ] . toLowerCase ( ) + name . slice ( 1 ) } >
28
71
${ parameterXML }
29
- </ids: ${ name [ 0 ] . toLowerCase ( ) + name . slice ( 1 ) } >` ;
72
+ </${ name [ 0 ] . toLowerCase ( ) + name . slice ( 1 ) } >` ;
30
73
31
74
return xml ;
32
75
} ;
0 commit comments