Nuno Frias
07/30/2024, 2:00 PMdiscriminator
I have the following example schema:
components:
schema:
full-request:
title: Full request
description: This is the full request
type: object
properties:
type:
description: Type of request
type: string
payload:
description: Request payload
type: object
oneOf:
- $ref: '#/components/schemas/ORIGIN_A'
- $ref: '#/components/schemas/ORIGIN_B'
discriminator:
propertyName: originator
required:
- type
- payload
ORIGIN_A:
type: object
schema:
allOf:
- $ref: '#/components/schemas/common'
- type: object
properties:
originator:
const: ORIGIN_A
originatorId:
$ref: '#/components/schemas/origin-id'
required:
- originator
- originatorId
ORIGIN_B:
type: object
schema:
allOf:
- $ref: '#/components/schemas/common'
- type: object
properties:
originator:
const: ORIGIN_B
required:
- originator
Pactflow is not able to handle the discriminator in this case, I get the following message:
discriminator: oneOf subschemas (or referenced schemas) must have "properties/originator"
Looking through the docs I can't understand why that isn't working.Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Nuno Frias
07/31/2024, 8:37 AMNuno Frias
07/31/2024, 12:36 PMbdct_test_1
attachment includes a OAS that resemble the example I originally reported, while the bdct_test
includes a variation in which the child schema that has the discriminator property is reference by a $ref
-- this is the case I have to deal with in reality, but both show the same error.Nuno Frias
07/31/2024, 1:06 PMallOf
is not used in the child schemas.Nuno Frias
08/01/2024, 8:20 AMNuno Frias
08/06/2024, 8:26 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Slackbot
08/07/2024, 10:27 AMNuno Frias
08/07/2024, 12:18 PMMatt (pactflow.io / pact-js / pact-go)