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

feat: support of record references in toplevel records #154

Merged

Conversation

M3lkior
Copy link
Collaborator

@M3lkior M3lkior commented Aug 5, 2022

Description

Given the following avro record:

{
   "type":"record",
   "name":"RecordWithReferences",
   "namespace":"com.example",
   "fields":[
      {
         "name":"Record1",
         "type":{
            "type":"record",
            "name":"Record1",
            "doc":"Reused in other fields",
            "fields":[
               {
                  "name":"string",
                  "type":"string",
                  "doc":"field in Record1"
               }
            ]
         }
      },
      {
         "name":"FieldThatDefineRecordInUnion",
         "type":[
            "null",
            {
               "type":"record",
               "name":"RecordDefinedInUnion",
               "namespace":"com.example.model",
               "doc":"",
               "fields":[
                  {
                     "name":"number",
                     "type":"long",
                     "doc":"field in RecordDefinedInUnion",
                     "minimum": 0,
                     "maximum": 2
                  }
               ]
            }
         ],
         "default":null
      },
      {
         "name":"FieldThatReuseRecordDefinedInUnion",
         "type":[
            "null",
            "com.example.model.RecordDefinedInUnion"
         ],
         "default":null
      },
      {
         "name":"FieldThatReuseRecord1",
         "type":[
            "null",
            "Record1"
         ],
         "default":null
      },
      {
        "name": "simpleField",
        "type": "string"
      }
   ]
}

Here is the generated result:
image-

Related issue(s)
Close #148

@M3lkior M3lkior force-pushed the feat/148-support-of-record-references branch 3 times, most recently from f9cb0c7 to dfef824 Compare August 11, 2022 15:33
@M3lkior M3lkior marked this pull request as ready for review August 11, 2022 15:43
The x-parser-schema-id is now defined for each record detected

Close asyncapi#148
@M3lkior M3lkior force-pushed the feat/148-support-of-record-references branch from dfef824 to 3c9b615 Compare August 11, 2022 15:51
@sonarcloud
Copy link

sonarcloud bot commented Aug 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@M3lkior M3lkior changed the title feat: support of record references feat: support of record references in toplevel records Aug 11, 2022
Copy link
Member

@fmvilas fmvilas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Collaborator

@dalelane dalelane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 👍

@M3lkior M3lkior merged commit b40dd93 into asyncapi:master Sep 5, 2022
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Manage reference to object declared previously in avro schema
4 participants