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

parse tags #216

Open
LittleWat opened this issue Jun 23, 2023 · 6 comments
Open

parse tags #216

LittleWat opened this issue Jun 23, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@LittleWat
Copy link

Reason/Context

Hello! I want to annotate PII tag to avro schemas
https://issues.apache.org/jira/browse/AVRO-3026

But this is ignored in AsyncAPI now.

Description

I created the folloiwng avro schema but the tag property is ignored in AsyncAPI.

{
  "type": "record",
  "name": "Greeting",
  "tags": [
    "PI",
    "PII"
  ],
  "fields": [
    {
      "name": "Sender",
      "type": "string",
      "doc": "the person who sent the message",
      "tags": {
        "<PII-KEY>": "<PII-VALUE>"
      },
      "default": "Api Curio"
    }
  ]
}

I'm glad if this is supported 🙏 Thank you!

@LittleWat LittleWat added the enhancement New feature or request label Jun 23, 2023
@github-actions
Copy link

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.

@derberg
Copy link
Member

derberg commented Aug 9, 2023

@dalelane @M3lkior please have a look

@dalelane
Copy link
Collaborator

dalelane commented Aug 9, 2023

@LittleWat I haven't seen the tags property in Avro schemas before. I don't see any mention of it in the Avro specification.

The JIRA issue you linked to was written by someone who was adding a tags property to their Avro schemas, saying that:

Avro AVSC files, being valid json, can easily be modified to add tags that will be used by downstream processors, and also wont interfere with Avro itself

Is that what you were proposing? That we adopt a convention where we look for additional properties that aren't part of the Avro specification, that we then copy into the AsyncAPI document?

@LittleWat
Copy link
Author

@dalelane Thank you for your reply! I didn't know that the tag property is not officially supported by the Avro specification. 🤦

I just want to show that the field contains PII in AsyncAPI.
All we can do is just use the doc property...? (Or any other choices...?)

Thank you!

@dalelane
Copy link
Collaborator

You can always modify an AsyncAPI doc to add additional information that isn't in the Avro schema.

If you prefer to keep everything within the Avro schema, then yes - you could use doc properties.

The only other idea I can think of just now is to adopt some naming convention - e.g. where fields with PII data all have names starting with pii_ - however that would make it difficult to change whether a field is considered PII, so I'd probably avoid that myself.

@M3lkior
Copy link
Collaborator

M3lkior commented Aug 21, 2023

I share @dalelane answer. Because the tag field is not part of the AVRO spec, i'm not comfortable with the idea to add a support of this root level field in the avro parser ;

If you link your avro file into the AsyncAPI spec, maybe you can use the tag attribute directly in your asyncapi document like


components:
  messages:
    ShareholderOrder:
       tags:
        - name:  "PI"
        - name: "PII"
      payload:
       $ref: "Greeting.avsc"

This will give you the following rendering:

image

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

No branches or pull requests

4 participants