-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: support LinkML field names with spaces. #75
Conversation
@@ -25,19 +25,19 @@ def __getattr__(self, attr: str) -> str: | |||
""" | |||
Error if a property doesn't exist | |||
""" | |||
raise NotImplementedError(f"please define field property {attr}") | |||
raise NotImplementedError(f"please define field property {self.wrapped_field.name}.{attr}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making the error messages a little more verbose / easier to debug.
@@ -507,7 +507,7 @@ async def create_{{ cls.snake_name }}( | |||
cerbos_client: CerbosClient = Depends(get_cerbos_client), | |||
principal: Principal = Depends(require_auth_principal), | |||
is_system_user: bool = Depends(is_system_user), | |||
) -> db.Entity: | |||
) -> db.{{ cls.name }}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These return the current type, there's no reason to tell the type checker that we return the base type. I think. 😅
@@ -293,6 +293,8 @@ classes: | |||
annotations: | |||
minimum_length: 3 | |||
maximum_length: 8 | |||
field with spaces: | |||
range: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example of a field with spaces in its name!
} | ||
""" | ||
output = await gql_client.query(query, user_id=user_id, member_projects=[project_id]) | ||
assert cct.field_with_spaces == output["data"]["constraintCheckedTypes"][0]["fieldWithSpaces"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check that this field is wired up properly from the test infrastructure all the way to the GQL interface!
Fixes #66
This adds support for LinkML fields with spaces. The spaces are converted to underscores when we write out
snake_case
field names, and then get converted tocamelCase
properly at word boundaries (basically just in the GQL interface)