ignoreRelatedModels (but include foreign key fields)
See original GitHub issueGreat work on this!
I was thinking of using a generated schema as a starting point for user input validation. In most cases, I would have no use for the relations.
model agedivision {
id Int @id @default(autoincrement())
ageDivName String @db.VarChar(30)
agedivision_athlete agedivision_athlete[]
athlete athlete[]
}
Currently produces:
{
"agedivision": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"agedivision_athlete": {
"type": "array",
"items": {
"$ref": "#/definitions/agedivision_athlete"
}
},
"athlete": {
"type": "array",
"items": {
"$ref": "#/definitions/athlete"
}
}
}
}
}
I would have liked:
{
"agedivision": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
}
}
Foreign keys would be included.
Is this a feature that you have plans for?
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Exclude models based on a value from another model with no ...
Exclude models based on a value from another model with no foreign key · Why did you not use a ForeignKey in the...
Read more >Changing Foreign Keys and Navigations - EF Core
Foreign keys are a good way to store and manipulate relationships in the database, but are not very friendly when working with multiple...
Read more >3 common foreign key mistakes (and how to avoid them)
Foreign key constraints are important to any SQL database, but they can also cause problems if they're not implemented correctly.
Read more >4. Using Convention and Configuration for Relationships
Code First allows you define relationships without using foreign key properties in your classes. However, some of the confusing behaviors that developers ...
Read more >Model field reference - Django documentation
Technically, these models are defined in django.db.models.fields , but for ... a ForeignKey . choices is meant for static data that doesn't change...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You are already able to also generate the relational scalar fields by enabling it in the settings:
Then userRoleId will be generated as well. And the only feature you would like to have is to ditch the relation fields. Am I right?
@Flax95 Thank you for opening up this issue!
Should the relations only be dropped, If they are not available in the schema or always?