Skip to content

Conversation

@Add1ct1ve
Copy link

  • Fix typo: registert_i_foretaksregisteret -> registrert_i_foretaksregisteret

  • Fix typo: trangsopplosning -> tvangsopplosning

  • Fix OrganisasjonsnummerValidator to accept int input by converting to str first

  • Fix incorrect docstring in get_roller method

- Fix typo: registert_i_foretaksregisteret -> registrert_i_foretaksregisteret

- Fix typo: trangsopplosning -> tvangsopplosning

- Fix OrganisasjonsnummerValidator to accept int input by converting to str first

- Fix incorrect docstring in get_roller method
organisasjonsnummer: Organisasjonsnummer,
) -> list[RolleGruppe]:
"""Get :class:`Enhet` given an organization number."""
"""Get roles for an entity given an organization number."""
Copy link
Member

@jodal jodal Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your suggestion might be more useful, but to be consistent with the other docstrings change to:

Suggested change
"""Get roles for an entity given an organization number."""
"""Get a list of :class:`RolleGruppe` given an organization number."""

Organisasjonsnummer = Annotated[
str,
BeforeValidator(lambda v: v.replace(" ", "")),
BeforeValidator(lambda v: str(v).replace(" ", "")),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the org number has been converted to an int, it will have lost leading zeros, so we should left-pad with zeros until we have nine digits.

Suggested change
BeforeValidator(lambda v: str(v).replace(" ", "")),
BeforeValidator(lambda v: str(v).replace(" ", "").zfill(9)),

The support for converting ints to org numbers deserves some test coverage.

@@ -0,0 +1,47 @@
# Fix typos and improve int input handling for OrganisasjonsnummerValidator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file.

- Update get_roller docstring to use :class:\RolleGruppe\ for consistency

- Add .zfill(9) to handle leading zeros when int is converted to org number

- Add test coverage for int-to-org-number conversion

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants