Skip to content

fix: type EntityTypeDef.poleType as PoleType literal union (#141) - #148

Open
1HazyOne707 wants to merge 1 commit into
neo4j-labs:mainfrom
1HazyOne707:fix/poletype-literal-union
Open

fix: type EntityTypeDef.poleType as PoleType literal union (#141)#148
1HazyOne707 wants to merge 1 commit into
neo4j-labs:mainfrom
1HazyOne707:fix/poletype-literal-union

Conversation

@1HazyOne707

Copy link
Copy Markdown

Summary

Fixes #141EntityTypeDef.poleType was typed as bare string, letting invalid/lowercase values pass TypeScript compilation only to fail at runtime with an opaque 422 schema validation failed from the server.

Changes

  • Added exported PoleType literal union: "PERSON" | "ORGANIZATION" | "LOCATION" | "EVENT" | "OBJECT" | "CUSTOM"
  • EntityTypeDef.poleType now uses PoleType instead of string
  • Documented RelationshipDef.source/target with JSDoc: they require an exact entity label from the same ontology schema — no wildcard ("*") support server-side, per the issue's findings
  • PoleType exported from the package root alongside the other ontology types
  • Wire-format deserialization (toDocument) uses an explicit as PoleType assertion since the raw server response is still typed as string (trusted boundary)

Closes #141

…s#141)

- Add exported PoleType type: PERSON | ORGANIZATION | LOCATION | EVENT | OBJECT | CUSTOM
- EntityTypeDef.poleType now uses PoleType instead of bare string,
  catching invalid/lowercase values at compile time instead of a
  runtime 422 from the server
- Document RelationshipDef.source/target as requiring an exact entity
  label from the same schema (no wildcard support server-side)
- Export PoleType from package root
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@1HazyOne707 is attempting to deploy a commit to the lyonwj's projects Team on Vercel.

A member of the Team first needs to authorize it.

@1HazyOne707

Copy link
Copy Markdown
Author

Heads up — the only failing check here is Vercel's deploy authorization gate, which needs a team member to approve (not something I can action from my side). The actual code change hasn't had a human review yet. Happy to rebase or adjust if anything's changed since I opened this, just wanted to surface it in case the bot-only failing check caused it to get skipped over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TypeScript SDK] EntityTypeDef.poleType typed as string — invalid values pass compile-time but fail at runtime with 422

1 participant