-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Feature] Add schema properties to models #51
Conversation
const schemaProperties: Array<keyof D2SchemaProperties> = [ | ||
"klass", | ||
"shareable", | ||
"metadata", | ||
"relativeApiEndpoint", | ||
"plural", | ||
"displayName", | ||
"collectionName", | ||
"nameableObject", | ||
"translatable", | ||
"identifiableObject", | ||
"dataShareable", | ||
"name", | ||
"persisted", | ||
"embeddedObject", | ||
]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we can do this using only the type, as types are not available on runtime....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a typical scenario, the idiomatic approach is to define the values and then derive the type:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with project-monitoring-app, I can access the models info as expected. And code looks good.
The only thing that bugs me a bit is that the models is not string indexed |
In
metadata-sync
we use a lotdisplayName
and sometimesplural
orcollectionName
from the schemas. It's the last usage we rely ond2
right now. As part of one of the latest tasks we are needingdisplayName
again and it didn't feel okay to used2
.