java-spring-cloud-stream-template
java-spring-cloud-stream-template copied to clipboard
Can't determine the type of property
Describe the bug.
Cannot generate code from the spec
Something went wrong:
Template render error: (node_modules@asyncapi\generator\node_modules@asyncapi\java-spring-cloud-stream-template\template\src\main\java$$everySchema$$.java) [Line 10, Column 51]
Error: Can't determine the type of property petType
at eval (eval at _compile (node_modules@asyncapi\generator\node_modules\nunjucks\src\environment.js:527:18),
Expected behavior
Code should be generated
Screenshots
How to Reproduce
ag ../polymorphism.yaml @asyncapi/java-spring-cloud-stream-template
🥦 Browser
None
👀 Have you checked for similar open issues?
- [X] I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- [X] I have read the Contributing Guidelines
Are you willing to work on this issue ?
None
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.
asyncapi: 2.6.0
info:
title: Example of schema using polymorphism
version: 2.6.0
channels:
pet:
subscribe:
message:
payload:
type: object
properties:
pet:
$ref: "#/components/schemas/Pet"
components:
schemas:
Pet:
type: object
discriminator: petType
properties:
name:
type: string
petType:
type: string
required:
- name
- petType
## applies to instances with `petType: "Cat"`
## because that is the schema name
Cat:
description: A representation of a cat
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
huntingSkill:
type: string
description: The measured skill for hunting
enum:
- clueless
- lazy
- adventurous
- aggressive
required:
- huntingSkill
## applies to instances with `petType: "Dog"`
## because that is the schema name
Dog:
description: A representation of a dog
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
packSize:
type: integer
format: int32
description: the size of the pack the dog is from
minimum: 0
required:
- packSize
## applies to instances with `petType: "StickBug"`
## because that is the required value of the discriminator field,
## overriding the schema name
StickInsect:
description: A representation of an Australian walking stick
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
petType:
const: StickBug
color:
type: string
required:
- color