@@ -96,12 +96,12 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
9696 /**
9797 * The AMF model.
9898 */
99- amf : Array < object > | object ;
99+ amf : Array < object > | object ;
100100
101101 /**
102102 * @param amf The AMF model.
103103 */
104- constructor ( amf ?: Array < object > | object ) ;
104+ constructor ( amf ?: Array < object > | object ) ;
105105
106106 /**
107107 * Lists media types names for payloads.
@@ -112,7 +112,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
112112 * @returns Returns a list of mime types or undefined
113113 * if not found.
114114 */
115- listMedia ( payloads : Array < object > | object ) : string [ ] | undefined ;
115+ listMedia ( payloads : Array < object > | object ) : string [ ] | undefined ;
116116
117117 /**
118118 * Generates a list of examples from an AMF Payloads array for a given media type.
@@ -125,7 +125,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
125125 * @param media A media to for which to generate the examples.
126126 * @returns Example value.
127127 */
128- generatePayloadsExamples ( payloads : Array < object > | object , media : String , opts ?: ExampleOptions ) : Array < Example > | undefined ;
128+ generatePayloadsExamples ( payloads : Array < object > | object , media : String , opts ?: ExampleOptions ) : Array < Example > | undefined ;
129129
130130 /**
131131 * Generates a list of examples for a single AMF Payload shape.
@@ -134,7 +134,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
134134 * @param mime A mime type to use.
135135 * @returns List of examples.
136136 */
137- generatePayloadExamples ( payload : object , mime : String , opts ?: ExampleOptions ) : Array < Example > | undefined ;
137+ generatePayloadExamples ( payload : object , mime : String , opts ?: ExampleOptions ) : Array < Example > | undefined ;
138138
139139 /**
140140 * Computes examples from an AMF shape.
@@ -149,15 +149,15 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
149149 * Besides that, `opts.typeId` is required to compute examples for a payload.
150150 * The `typeId` is a value of `@id` of the Payload shape.
151151 */
152- computeExamples ( schema : object , mime : String , opts ?: ExampleOptions ) : Example [ ] | undefined ;
152+ computeExamples ( schema : object , mime : String , opts ?: ExampleOptions ) : Example [ ] | undefined ;
153153
154154 /**
155155 * Reads a raw value of JSON schema if available.
156156 *
157157 * @param schema Schema shape of a type.
158158 * @returns JSON schema if exists.
159159 */
160- _readJsonSchema ( schema : object ) : String | undefined ;
160+ _readJsonSchema ( schema : object ) : String | undefined ;
161161
162162 /**
163163 * Computes examples value from a list of examples.
@@ -169,7 +169,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
169169 * Besides that, `opts.typeId` is required to compute examples for a payload.
170170 * The `typeId` is a value of `@id` of the Payload shape.
171171 */
172- _computeFromExamples ( examples : Array < object > , mime : String , opts ?: object ) : Array < object > | undefined ;
172+ _computeFromExamples ( examples : Array < object > , mime : String , opts ?: object ) : Array < object > | undefined ;
173173
174174 /**
175175 * In AMF 4 the examples model changes from being an array of examples
@@ -182,15 +182,15 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
182182 * @param examples Examples model.
183183 * @returns List of examples to process.
184184 */
185- _processExamples ( examples : object [ ] | object ) : any [ ] | undefined ;
185+ _processExamples ( examples : object [ ] | object ) : any [ ] | undefined ;
186186
187187 /**
188188 * Uses Example shape's source maps to determine which examples should be rendered.
189189 *
190190 * @param examples List of AMF Example shapes.
191191 * @param typeId Payload ID
192192 */
193- _listTypeExamples ( examples : Array < object > , typeId : String ) : Array < object > | undefined ;
193+ _listTypeExamples ( examples : Array < object > , typeId : String ) : Array < object > | undefined ;
194194
195195 /**
196196 * Generate an example from an example shape.
@@ -199,15 +199,15 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
199199 * @param mime Example content type.
200200 * @param opts Processing options.
201201 */
202- _generateFromExample ( example : object , mime : String , opts ?: ExampleOptions ) : Example | undefined ;
202+ _generateFromExample ( example : object , mime : String , opts ?: ExampleOptions ) : Example | undefined ;
203203
204204 /**
205205 * Computes list of examples for an array shape.
206206 * @param schema The AMF's array shape
207207 * @param mime Current mime type
208208 * @param [opts={ }]
209209 */
210- _computeExampleArrayShape ( schema : object , mime : string , opts ?: ExampleOptions ) : Array < Example > | undefined ;
210+ _computeExampleArrayShape ( schema : object , mime : string , opts ?: ExampleOptions ) : Array < Example > | undefined ;
211211
212212 /**
213213 * Computes example for an `and` shape.
@@ -233,21 +233,22 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
233233 * @param mime Current mime type
234234 * @param [opts={ }]
235235 */
236- _computeUnionExamples ( schema : object , mime : string , opts ?: ExampleOptions ) : Array < Example > | undefined ;
236+ _computeUnionExamples ( schema : object , mime : string , opts ?: ExampleOptions ) : Array < Example > | undefined ;
237237
238238 /**
239239 * Computes value from defined `datatype` property.
240240 *
241241 * @param shape A shape with `datatype` property.
242242 * @returns Value of the data type.
243243 */
244- _computeScalarType ( shape : object ) : string | undefined ;
244+ _computeScalarType ( shape : object ) : string | undefined ;
245245
246246 /**
247247 * Creates a JSON example representation from AMF example's structure
248248 * definition.
249249 */
250- _jsonFromStructure ( structure : object ) : any | undefined ;
250+ _jsonFromStructure ( structure : object ) : any | undefined ;
251+
251252 /**
252253 * Creates a JSON object structure from an example.
253254 * This object is later on serialized to the example string value.
@@ -258,7 +259,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
258259 * @param key Processed object's key
259260 * @param resolvedPrefix AMF's `data:` prefix
260261 */
261- _jsonFromStructureValue ( value : Object | Array < any > | number | string , obj : Object | Array < any > , isArray : boolean , key ?: string , resolvedPrefix ?: string ) : void ;
262+ _jsonFromStructureValue ( value : Object | Array < any > | number | string , obj : Object | Array < any > , isArray : boolean , key ?: string , resolvedPrefix ?: string ) : void ;
262263
263264 /**
264265 * Generates XML example string value from AMF's structured value definition.
@@ -272,7 +273,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
272273 * @param structure Value of the `structuredValue` property of AMF's example object.
273274 * @return Value casted to a type
274275 */
275- _getTypedValue ( structure : object ) : string | number | boolean | null ;
276+ _getTypedValue ( structure : object ) : string | number | boolean | null ;
276277
277278 /**
278279 * Creates a example structure for the JSON schema.
@@ -292,22 +293,22 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
292293 * @param typeName Name of the RAML type.
293294 * @param parentType For XML processing, parent type name in case of Array type.
294295 */
295- _exampleFromProperties ( properties : object [ ] , mime : string , typeName ?: string , parentType ?: string ) : Example | undefined ;
296+ _exampleFromProperties ( properties : object [ ] , mime : string , typeName ?: string , parentType ?: string ) : Example | undefined ;
296297
297298 /**
298299 * Generates a JSON example from RAML's type properties.
299300 *
300301 * @param properties List of type properties
301302 */
302- _jsonExampleFromProperties ( properties : Array < object > ) : object | null | undefined ;
303+ _jsonExampleFromProperties ( properties : Array < object > ) : object | null | undefined ;
303304
304305 /**
305306 * Computes JSON value from a range shape.
306307 *
307308 * @param range AMF's range model.
308309 * @param typeName Optional, type name to use in Union type. By default first NodeShape.
309310 */
310- _computeJsonPropertyValue ( range : object , typeName ?: string ) : any | undefined ;
311+ _computeJsonPropertyValue ( range : object , typeName ?: string ) : any | undefined ;
311312
312313 /**
313314 * Computes scalar value for AMF's range and casts it to the corresponding type.
@@ -317,7 +318,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
317318 * @param range AMF's range definition for a shape.
318319 * @returns Value casted to the corresponding type
319320 */
320- _computeJsonScalarValue ( range : object ) : string | number | boolean | null ;
321+ _computeJsonScalarValue ( range : object ) : string | number | boolean | null ;
321322
322323 /**
323324 * Computes default value for given range.
@@ -330,7 +331,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
330331 * @param range AMF's range definition for a shape.
331332 * @returns Value casted to the corresponding type
332333 */
333- _computeDefaultRangeValue ( range : object ) : string | number | boolean | null ;
334+ _computeDefaultRangeValue ( range : object ) : string | number | boolean | null ;
334335
335336 /**
336337 * Casts the value to given data type represented in AMF notation.
@@ -339,45 +340,45 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
339340 * @param type AMF data type
340341 * @returns Casted value.
341342 */
342- _typeToValue ( value : string , type : string ) : string | number | boolean | null ;
343+ _typeToValue ( value : string , type : string ) : string | number | boolean | null ;
343344
344345 /**
345346 * Computes JSON example from UnionShape
346347 *
347348 * @param range Type definition
348349 * @param typeName Optional, type name to use. By default first NodeShape.
349350 */
350- _computeJsonUnionValue ( range : object , typeName ?: String ) : object | undefined ;
351+ _computeJsonUnionValue ( range : object , typeName ?: String ) : object | undefined ;
351352
352353 /**
353354 * Computes JSON object as an example from a range that is an object.
354355 *
355356 * @param range AMF's range definition for a shape.
356357 * @returns A JavaScript object computed from the properties.
357358 */
358- _computeJsonObjectValue ( range : object ) : any | undefined ;
359+ _computeJsonObjectValue ( range : object ) : any | undefined ;
359360
360361 /**
361362 * Computes JSON object as an example from a range that is an array.
362363 *
363364 * @param range AMF's range definition for a shape.
364365 * @return A JavaScript array computed from the items.
365366 */
366- _computeJsonArrayValue ( range : object ) : object [ ] | undefined ;
367+ _computeJsonArrayValue ( range : object ) : object [ ] | undefined ;
367368
368369 /**
369370 * Reads raw value of the example.
370371 * @param example AMF's example definition.
371372 * @return Raw example value.
372373 */
373- _extractExampleRawValue ( example : Array < Object > | Object ) : String | undefined ;
374+ _extractExampleRawValue ( example : Array < Object > | Object ) : String | undefined ;
374375
375376 /**
376377 * Gets a value from a Range shape for a scalar value.
377378 *
378379 * @param range AMF's range model.
379380 */
380- _getTypeScalarValue ( range : object ) : string | number | boolean | null ;
381+ _getTypeScalarValue ( range : object ) : string | number | boolean | null ;
381382
382383 /**
383384 * Computes example from a range's properties for XML media type.
@@ -449,7 +450,8 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
449450 * @param property A property to read the name from. Usually range.
450451 * @return Normalized name or undefined if name is not defined.
451452 */
452- _getXmlNormalizedName ( property : object ) : string | undefined ;
453+ _getXmlNormalizedName ( property : object ) : string | undefined ;
454+
453455 /**
454456 * Adds elements to the node which are an array.
455457 *
@@ -485,7 +487,7 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
485487 * @param model `structuredValue` item model.
486488 * @returns Javascript object or array with structured value.
487489 */
488- _computeExampleFromStructuredValue ( model : object ) : object | object [ ] | null ;
490+ _computeExampleFromStructuredValue ( model : object ) : object | object [ ] | null ;
489491
490492 /**
491493 * Computes value with property data type for a structured example.
@@ -516,4 +518,11 @@ declare class ExampleGenerator extends AmfHelperMixin(Object) {
516518 _processDataObjectProperties ( doc : Document , node : Element , property : object ) : void ;
517519
518520 _getTrackedValue ( tracked : any ) : string ;
521+
522+ /**
523+ * Generates XML example string value from AMF's structured value definition.
524+ * @param {Object } serialization Value of the `serialization` property of AMF's object.
525+ * @return {XmlData }
526+ */
527+ _computeXmlSerializationData ( serialization ) : object ;
519528}
0 commit comments