Specifying unknown facet: 'properties'


#1

For my API, I am getting an error at the word “properties” saying "Specifying unknown facet: ‘properties’ ". I’m trying to create a schema under “types” like -

xyz:
minItems: 1
maxItems: 50
type: array
items: {}
properties:
a:
type: string
minlength: 1
maxlength: 16
b:
type: string
minlength: 1
maxlength: 16
c:
type: string
minlength: 1
maxlength: 16

(Indentation though not getting picked up by this textbox, has been used appropriately in my code)


#2

Where did you get the ‘{}’ notation from? I have never seen that before.
If i remove that your type basically works, although i’d throw in a “type: object” for good measure (and it might be even neater to break out the item type altogether and refer to it by name).
Also note that min/maxLength is spelled with an upperacse L.

So this is what i arrived on:

xyz:
  type: array
  minItems: 1
  maxItems: 50
  items:
    type: object
    properties:
      a:
        type: string
        minLength: 1
        maxLength: 16
      b:
        type: string
        minLength: 1
        maxLength: 16
      c:
        type: string
        minLength: 1
        maxLength: 16

#3

Hi,

Thanks for your reply. I had got this items {} part automatically when I imported my swagger 2.0 code to Design Center where it became a RAML (auto-converted). The error got resolved.

However, another glitch has come to light during mocking as this error got resolved. The request body properties though required are still behaving as optional and returning 200 success code when mocked. The input for this has been one or more of the request properties being omitted.

Another failure is that minLength part is not working as expected in mocking. If I give the string input as ””, it is returning a 200 success code even though it should not allow lesser than 1 length.

Kindly suggest me why these glitches are coming and how to resolve them.

You can find the design spec and mocking screenshots attached.

Regards,

Tanya Gujral

RAML
#%RAML 1.0
baseUri: https://mocksvc.mulesoft.com/mocks/ad4d10c3-8ed9-4d0e-8a93-154c61b6f32f # baseUri: https://mocksvc.mulesoft.com/mocks/72330ef0-d026-41e9-bf88-3449ec83616e #
title: test-xyz-validation
description: ‘’‘Test the API’’’
version: 1.0.0
annotationTypes:
oas-tags-definition:
allowedTargets: API
type: array
items:
type: object
properties:
name: string
description?: string
externalDocs?:
properties:
url: string
description?: string
oas-format:
type: string
allowedTargets: TypeDeclaration
oas-responses-default:
type: any
allowedTargets: Method
oas-body-name:
type: string
allowedTargets: TypeDeclaration
oas-summary:
type: string
allowedTargets: Method
oas-tags:
type: ‘string
allowedTargets: Method
(oas-tags-definition):

  • name: /rm/causeValidation
    description: Cause Validation
    protocols:
  • HTTPS
  • HTTP

types:
Error:
type: object
properties:
code:
type: string
message:
type: string

xyz:
type: array
minItems: 1
maxItems: 50
items:
type: object
properties:
x:
type: string
minLength: 1
maxLength: 16
required: true
y:
type: string
minLength: 1
maxLength: 11
required: true
z:
type: string
minLength: 1
maxLength: 19
required: true

response-xyzValidation:
type: object
properties:
x:
type: string
required: true
status:
type: string
required: true
message:
type: string
required: true

/rm:
/xyzValidation:
/xyzValidate:
post:
description: ‘Validate’
displayName: validate
(oas-responses-default):
description: unexpected error
body:
application/xml:
type: Error
application/json:
type: Error
responses:
‘200’:
description: xyz validation status
body:
application/xml:
type: array
items:
type: response-xyzValidation
application/json:
type: array
items:
type: response-xyzValidation
‘400’:
description: invalid input
body:
application/xml:
type: Error
application/json:
type: Error
‘404’:
description: result not found
body:
application/xml:
type: Error
application/json:
type: Error
body:
application/json:
type: xyz
(oas-body-name): body
application/xml:
type: xyz
(oas-body-name): body
(oas-summary): ‘API validating xyz.’
(oas-tags):
- /rm/xyzValidation