Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing elements from deeply nested objects #58

Closed
kostisthomaidis opened this issue Sep 8, 2020 · 4 comments
Closed

Missing elements from deeply nested objects #58

kostisthomaidis opened this issue Sep 8, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@kostisthomaidis
Copy link

Describe the bug

Hi everyone! We are developing a car dealership application and we are trying to incorporate AsyncAPI to our stack.
Using the AsyncAPI Playground to test the file, I found that some nested objects (3 levels deep) were not created in full.
After cloning the project and debugging locally, I traced that the file was properly parsed and could find it as context up to this point in the call stack:
Screenshot from 2020-09-07 18-13-32
Screenshot from 2020-09-07 18-12-35
However, I am not very familiar with JS and could use some help with this.

How to Reproduce

An example of the bug lies in the component payload -> previousOwners -> individual, under jsonMessage. The component has more properties, but they have not been rendered.

Expected behavior

Properties of deeply nested objects (like the example above) should be rendered.

@kostisthomaidis kostisthomaidis added the bug Something isn't working label Sep 8, 2020
@github-actions
Copy link

github-actions bot commented Sep 8, 2020

Welcome to AsyncAPI. Thanks a lot for reporting your first issue.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@fmvilas
Copy link
Member

fmvilas commented Sep 8, 2020

Hey @kostisthomaidis! I found the problem here. It's actually a bug on your AsyncAPI definition:

    individual:
      type: object
      firstName:
        type: string
        description: First name of individual.
      lastName:
        type: string
        description: Last name of individual.
      employment:
        type: string
        description: Employment of individual
      usage:
        type: string
        description: Usage of car by owner
        enum:
          - Holiday
          - Work
          - Commute
      mileage:
        type: integer
        description: Mileage under this owner

You're missing the properties key here. It should be:

    individual:
      type: object
      properties: # <== Notice this field
        firstName:
          type: string
          description: First name of individual.
        lastName:
          type: string
          description: Last name of individual.
        employment:
          type: string
          description: Employment of individual
        usage:
          type: string
          description: Usage of car by owner
          enum:
            - Holiday
            - Work
            - Commute
        mileage:
          type: integer
          description: Mileage under this owner

The reason it's not failing is that it's not illegal to place disparate fields on a JSON Schema object.

Hope it helps!

@fmvilas fmvilas closed this as completed Sep 8, 2020
@kostisthomaidis
Copy link
Author

Thank you so much for your swift reply! This indeed fixes the issue!

@Aravindhsiva
Copy link

@fmvilas I just checked my schema, where I do have properties key after all the type:object line,
It didn't show the children in the output...
Same thing is working, If I put it under diff parent with less parents
If I try it under more parents like 7-10 parents, It didn't show up in the output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants