0
votes

I am defining a RAML 1.0 datatype with property that can be 'nil.' The type of that property is an !included datatype which, whilst not giving any errors in the datatype definition causes the root object to throw a "Unresolved reference '!includereference-data.raml' at libraries/types/personal-details.raml (10, 12)'

I've tried converting the DataType to a library to try and implement a "uses" or "types" but that impacts all the other objects that include this data type.

#%RAML 1.0 DataType

properties:  
  DateOfBirth: datetime
  FirstName: string
  FamilyName: nil | string
  PreferredName: nil | string
  PreviousNames: nil | string
  Title:  !include reference-data.raml
  Gender:  nil | !include reference-data.raml

The 'Title' property is working as expected, the error is thrown against the Gender property - I actually want both to be nillable.

1

1 Answers

0
votes

The datatype to hold nillable properties here is "name_block.raml"

#%RAML 1.0 DataType
uses:
  lib: base_types.raml
type: object
properties:
  FirstName:  lib.string30
  MiddleName: lib.nstring30
  LastName:   lib.string150

The included library (base_types.raml) is defined as

#%RAML 1.0 Library
types:
  string30:
    type: string
    minLength: 0
    maxLength: 30

  string150:
    type: string
    minLength: 0
    maxLength: 150

  nstring30:
    type: string | nil

If anyone knows of a better way - It would be great to see it.