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

add support for decorators to schema langauge #202

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ecordell
Copy link
Contributor

@ecordell ecordell commented Oct 21, 2021

Supports decorators of the forms:

@decoratorName
@decoratorName(opt1,opt2)
@decoratorName(opt1,(opt2a,opt2b))

This parses the decorators into the AST as a new edge type from the items they decorate (currently only supported within definition blocks, pending more discussion of how they will be used)

  • basic decorators
  • options
  • nested options
  • multiple decorators for the same statement
  • strings or identifiers as option values

@github-actions github-actions bot added the area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) label Oct 21, 2021
@ecordell ecordell added the state/needs discussion This can't be worked on yet label Oct 21, 2021
supports decorators of the forms:

@decoratorName
@decoratorName(opt1,opt2)
@decoratorName(opt1,(opt2a,opt2b))

Signed-off-by: Evan Cordell <cordell.evan@gmail.com>
@alsbury
Copy link

alsbury commented Dec 6, 2022

We are looking for the ability to add basic metadata to schemas. Our use case is that we want to be able to add things like descriptions, categories, tags.

`
@description('This would likely be a multi-line description describing the definition/relation/permission')
definition user {}

@description('My description for application')
definition application {

@category(['application','users'])
@description('A description of the user admins relationship')
relation user_admins: user | group#members

@category(['application','users'])
@description('A description of the user readers relationship')
relation user_readers: user | group#members

@description('A description for user write permission')
permission user_write = user_admins

@description('A description for user read permission')
permission user_read = user_write + user_readers

}
`
At a minimum, we are looking for a way to pass key/values pairs related to an identifier from the schema.

@josephschorr
Copy link
Member

@alsbury description should be put into doc comments like so:

    /**
     * reader indicates that the user is a reader on the document.
     */
    relation reader: user

@alsbury
Copy link

alsbury commented Dec 6, 2022

@josephschorr yeah, I can see how description may be best like that. I'm in the middle of sorting out how we will use the metadata. I do see us using a human readable label with a longer description as a possibility. That along with metadata for how to group data for UI's. Once our use case is better defined I might have more useful feedback.

@josephschorr
Copy link
Member

josephschorr commented Dec 6, 2022

@alsbury yeah, makes perfect sense. The reason we kept the comment data in the parsed protos was so that we could use the entered descriptions in generated code down the road

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) state/needs discussion This can't be worked on yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants