Should SerializeV2WithoutReference resolve in object references as well? #93
-
Hi, SerializeV2WithoutReference currently only resolves top-level reference & uses internally SerializeV2 for properties of the AsyncApiSchema. In my use-case I am trying to extract payload schema to validate my de-serialized model in test against schema with JsonSchema package. That results in JSON like this:
testB is still unresolved so I would need to jump through hoops to actually use this JsonSchema to validate my serialized JSON. Is there any reason to not serialize completely without references, or some way to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Ive spent a bit more time on the issue, trying to streamline this a bit for the payload schemas. With default settings you will get an output like this channels:
mychannel:
publish:
message:
payload:
type: object
required:
- testB
properties:
testC:
$ref: '#/components/schemas/testC'
testB:
$ref: '#/components/schemas/testB'
components:
schemas:
testD:
type: string
format: uuid
testC:
type: object
properties:
testD:
$ref: '#/components/schemas/testD'
testB:
type: boolean
description: test But if you instead use the inlinereferences setting like so var outputString = new StringWriter(CultureInfo.InvariantCulture);
var writer = new AsyncApiYamlWriter(outputString, new AsyncApiWriterSettings { ReferenceInline = ReferenceInlineSetting.InlineReferences });
asyncApiDocument.SerializeV2(writer); you will get an output like the following channels:
mychannel:
publish:
message:
payload:
type: object
required:
- testB
properties:
testC:
type: object
properties:
testD:
type: string
format: uuid
testB:
type: boolean
description: test
components: { } |
Beta Was this translation helpful? Give feedback.
Ive spent a bit more time on the issue, trying to streamline this a bit for the payload schemas.
Anyway.. I will make a PR that fixes this.
With default settings you will get an output like this