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

Inconsistencies in Element API related to use of navigation properties #7619

Open
khanaffan opened this issue Jan 27, 2025 · 1 comment
Open
Labels
breaking change enhancement New feature or request
Milestone

Comments

@khanaffan
Copy link
Contributor

khanaffan commented Jan 27, 2025

Inconsistencies in Element Api. Mainly there is bunch of places where we have navigation properties but we name or typed them inconsistently.

  1. Elemen.model should have been a r RelatedModel type
  2. GeometricElement.category should have been a RelatedCategory type.
  3. Model .parentModel should have been RelatedModel type.
  4. ViewDefintion.categorySelectionId should be RelatedCategory and it has Id postfix unlike model, category and parentModel
  5. ViewDefintion.displayStyleId should be RelatedDisplayStyle and it has Id postfix unlike model, category and parentModel
  6. ViewDefinition2d.baseModelId should be RelatedModel type and it has Id postfix unlike model, category and parentModel

Generally all navigation properties should be defined a such { id: Id64String, relClassName: string } using the RelatedElementProps interface

// Navigation properties
export class Element {
	public readonly model: Id64String;  // Navigation property
}
  
export abstract class GeometricElement {
	public category: Id64String;       // Navigation property	  
}

export class Model extends Entity {
	public readonly parentModel!: Id64String; // Navigation property
}
 
export abstract class ViewDefinition extends DefinitionElement {
	public categorySelectorId: Id64String;   // Navigation property
	public displayStyleId: Id64String;       // Navigation property
}
 
export class SpatialViewDefinition extends ViewDefinition3d {
	public modelSelectorId: Id64String;       // Navigation property
}

export class ViewDefinition2d extends ViewDefinition {
	public baseModelId: Id64String;           // Navigation property
}

// Json props
export interface ElementProps extends EntityProps {
	jsonProperties?: any;  // could be of same type as Element [key: string]: any;
}
@khanaffan
Copy link
Contributor Author

@ColinKerr @aruniverse I logged the inconsistency that I found with element api.

@khanaffan khanaffan changed the title Inconsistences in itwin.js Element API related to use of navigation properties Inconsistencies in itwin.js Element API related to use of navigation properties Jan 27, 2025
@khanaffan khanaffan added bug Something isn't working enhancement New feature or request breaking change and removed bug Something isn't working labels Jan 27, 2025
@khanaffan khanaffan changed the title Inconsistencies in itwin.js Element API related to use of navigation properties Inconsistencies in Element API related to use of navigation properties Jan 27, 2025
@aruniverse aruniverse added this to the iTwin.js 5.0 milestone Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants