data-structures: a same-model manyToOne's declared foreignKey is not enforced - a write naming a non-existent target id is stored
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 51/100
Direzione di ricerca
Start by tracing how the synchronizer creates tables from the generated .schema and how generated controllers handle writes for same-model manyToOne relations. Compare the declared foreignKey with the stored Kind and PriceList values described here. Done means a write with a nonexistent target id is rejected, either by a database constraint or controller check; the issue does not name specific source files or tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
A same-model manyToOne (both entities in one intent, one .schema) accepts an id that does not exist. The generated .schema declares the relation as a foreignKey structure, but no constraint stops the write - on a FRESH dirigiblelabs/dirigible:14.95.0 instance (tables created by the synchronizer from that .schema):
customers.intent: - { name: Kind, kind: manyToOne, to: CustomerKind, init: 1, size: 4 } # CustomerKind seeded 1, 2
gen/customers/schema/customers.schema:
{"name": "Customer_Kind", "type": "foreignKey", "table": "CUSTOMERS_CUSTOMER", "constraintName": "Customer_Kind",
"columns": "CUSTOMER_KIND", "referencedTable": "CUSTOMERS_CUSTOMER_KIND", "referencedColumns": "CUSTOMER_KIND_ID"}
POST /services/java/customers/gen/customers/api/customer/CustomerController {"Name":"fk probe","Kind":999} -> 200, Kind 999 stored
The same holds for PriceList (seeded 1-5, 999 stored). Found by the BusinessIntents 1.32.0 hunt (base-customers#56): a customer of Kind 999 is neither Business nor Individual, so the invoice Issue gate keyed on Customer.Kind == 1 (the registration-number requirement) never applies - an invoice was ISSUED to a business with no ЕИК.
Expected
Either the declared foreign key exists in the database for a same-model relation (the write fails, ideally as a 400 naming the relation rather than a 500), or the generated controller checks that the target row exists. A cross-model to-one has no FK by design; a same-model one is in the same .schema and could.
Workaround in the module
checks: - { kind: forbidWhen, when: ["Kind != null", "Kind.name == null"] } per relation (the #7555 null test over a one-hop path) - one check per relation of every entity, which a schema constraint would make unnecessary.
- Lingua principale
- Java
- Stelle
- 278
- Fork
- 97
- Merge medio
- 16h 46m
- PR unite (30g)
- 265
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di eclipse-dirigible/dirigible
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
eclipse-dirigible/dirigible#7958 ·
I maintainer di solito rispondono entro 1 giorno
-
intent: a create-from without fromStatus answers 200 on a missing or unknown source id (no 400/404)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
eclipse-dirigible/dirigible#7945 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
eclipse-dirigible/dirigible#7891 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
eclipse-dirigible/dirigible#6538 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
eclipse-dirigible/dirigible#4812 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di eclipse-dirigible/dirigible
Issue simili
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefixForse già presa @ItsDeadlyProgrammer l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
appsmithorg/appsmith#42471 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
code-maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
bug priority: medium Review effort [1-5]: 3 status: needs-triage type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
carlos-emr/carlos#5258 ·
I maintainer di solito rispondono entro 1 giorno
-
bug: author create/update with an unknown avatarId returns 404 instead of 400 UNKNOWN_REFERENCEForse già presa @Vinu2111 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
atomityhq/blog-cms#59 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
PlatformSpecific.hasGreenThreads incorrectly returns false for JDK updates and non-GA versionsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno