Hi all I am experiencing an issue with `discrimin...
# pactflow-ama
n
Hi all I am experiencing an issue with
discriminator
I have the following example schema:
Copy code
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:
Copy code
discriminator: oneOf subschemas (or referenced schemas) must have "properties/originator"
Looking through the docs I can't understand why that isn't working.
m
Hi Nuno, could you please share a minimally complete OAS that we can use as an example? Ideally a minimal pact file to go with it would be great. We can then investigate
n
I shall do that
thankyou 1
The following two attachments contain two variations on the same minimal example (which includes a Pact contract and an OAS) that cause the issue I reported. The
bdct_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.
Btw the discriminator works fine if
allOf
is not used in the child schemas.
👍 1
@Matt (pactflow.io / pact-js / pact-go) Did you manage to reproduce the issue?
@Matt (pactflow.io / pact-js / pact-go) Hi Matt Any updates on this issue ?
m
Sorry Nuno, I missed your post on this. It looks like a bug to me.
I’ll need an engineer on the team to dig into it further, sorry to ask, but could you please raise a support ticket (howtosupport)?
s
Please create a ticket here with the issue details so that we can properly track the resolution and the PactFlow product support team will continue to work through it with you: https://support.smartbear.com/pactflow/message
n
Hi @Matt (pactflow.io / pact-js / pact-go) Created the issue (ref 00665078). Still waiting for the confirmation email though.
thankyou 1
m
thx, i’ll request it is passed directly to the engineering team Nuno
🙌 1