Skip to content

Best way to restrict references? #360

Answered by spoenemann
paulfrench asked this question in Q&A
Discussion options

You must be logged in to vote

There are multiple ways to solve that:

  • Split the Property rule in two variants, one for primitive types and one for complex types, and use the primitive variant in the cross-reference (not recommended).
  • Change the ScopeProvider service so it filters the properties to include only those with primitive types (not recommended).
  • Add a validation check that shows an error when a property with complex type is used as key, and adapt the CompletionProvider service to show only the properties with primitive type for that cross-reference.

I recommend the third approach because it results in a much better error message to the users: Instead of "Could not resolve reference..." they will see somethi…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@paulfrench
Comment options

@paulfrench
Comment options

@msujew
Comment options

Answer selected by paulfrench
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants