Closed mflorczak closed 3 years ago
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
@mflorczak Hi! Could you add more information like which template do you want to use?
Have in mind that some templates doesn't support specification with the circular references.
EDIT: Could you also add the given spec with circular refs as plain text in the comment, not as images?
Hello! I used java-spring-template
type: object
properties:
id:
type: integer
format: int64
name:
type: string
created:
type: string
format: date-time
stamp:
type: string
format: date-time
children:
type: array
items:
$ref: "../async-consume.yaml#/components/schemas/NodeAdto"
channels:
flexible-production:
description: flexible production topic.
publish:
summary: Listens on shopfloor execution context topic.
operationId: flp
message:
name: templatePointerMessage
title: template with decoded name
summary: template pointer message.
contentType: application/json
payload:
$ref: '#/components/schemas/TemplatePointerAdto'
components:
schemas:
TemplatePointerAdto:
$ref: './schemas/TemplatePointer.yaml'
TemplateAdto:
$ref: './schemas/Template.yaml'
ProcessAdto:
$ref: './schemas/Process.yaml'
NodeAdto:
$ref: './schemas/Node.yaml'
NodeLinkAdto:
$ref: './schemas/NodeLink.yaml'
type: object
description: template pointer.
events:
- TEMPLATE_POINTER_CREATED
properties:
itemId:
type: string
template:
$ref: "../async-consume.yaml#/components/schemas/NodeAdto"
Currently we support the circular refs in the spec, but not in every places (more info here). Generator can parse/validate your spec and pass it to the template. The given error is throw by this line https://github.com/asyncapi/java-spring-template/blob/master/filters/all.js#L101 Native JSON. stringify
function doesn't support the circular refs, so it's not a problem with generator, but it's related with template itself. I will close the issue, and please continue the discussion here.
Also please don't cut the error, because this line:
is most important :P
Describe the bug I want to create tree structure which each object has list of the same types.
How to Reproduce This is my schemas components
It is recursive tree model
And this is error
Expected behavior As a user I want to be able to create recursive model eg. trees graphs etc.