This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Description
Consider the following RAML
types:
event:
type: object
discriminator: eventType
properties:
eventType: string
fooEvent:
type: event
discriminatorValue: foo
properties:
bar: string
/resource:
post:
body:
application/json:
type: fooEvent
Expected behavior
resource/ should accept a value such as:
{"eventType":"foo", "bar":"val"}
and reject a value such as:
{"not":"acceptable"}
Current behavior
Both are considered valid.
Seems to me the issue is that unless the discriminator field is present there's no validation at all and everything is valid.
There should be a validation that the discriminator field exists and then check for valid values of that field and validate accordingly, otherwise it should fail.
I added test cases in this PR #602
Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-39