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

bug: Schema integrity check fails when you have 2 schema nodes defined with the same name but different namespace #3986

Closed
wvandeun opened this issue Aug 1, 2024 · 2 comments
Assignees
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected

Comments

@wvandeun
Copy link
Contributor

wvandeun commented Aug 1, 2024

Component

API Server / GraphQL

Infrahub version

0.16.0

Current Behavior

When you define 2 nodes in the schema with the same name, but a different namespace then the schema integrity check fails during the proposed change.

image

infrahubctl schema load or infrahubctl schema check do not complain about the schema.

Expected Behavior

The schema integrity check should succeed since the nodes have been defined in a different namespace.

Steps to Reproduce

  • create a branch
  • load this schema
---
version: "1.0"
nodes:
  - name: Device
    namespace: Zorro
    label: "Device"
    display_labels:
      - name__value
    attributes:
      - name: name
        kind: Text
        unique: true
      - name: description
        kind: Text
        optional: true
  - name: Device
    namespace: Infra
    label: "Device"
    display_labels:
      - name__value
    attributes:
      - name: name
        kind: Text
        unique: true
      - name: description
        kind: Text
        optional: true
  • create a proposed change to merge the branch into main
  • schema integrity check will fail

Additional Information

No response

@wvandeun wvandeun added the type/bug Something isn't working as expected label Aug 1, 2024
@exalate-issue-sync exalate-issue-sync bot added the state/need-triage This issue needs to be triaged label Aug 1, 2024
@wvandeun
Copy link
Contributor Author

wvandeun commented Aug 2, 2024

The same issue occurs when you have 2 generics defined in your schema that have the same name, but use a different namespace.

@lykinsbd lykinsbd added this to the Infrahub - 0.15.3 milestone Aug 5, 2024
@pa-lem pa-lem added the group/backend Issue related to the backend (API Server, Git Agent) label Aug 6, 2024
@BeArchiTek BeArchiTek changed the title bug: schema integrity check fails when you have 2 schema nodes defined with the same but different namespace bug: Schema integrity check fails when you have 2 schema nodes defined with the same name but different namespace Aug 7, 2024
ogenstad added a commit that referenced this issue Aug 8, 2024
Currenly we treat SchemaNode objects in the same way as any other, this
causes problems if multiple schema objects has the same constraints i.e.
two of them has an attribute called "name" and that attribute is marked
as being unique for that particular model.

Fixes #3986
@ogenstad
Copy link
Contributor

ogenstad commented Aug 9, 2024

Fixed in #4029.

@ogenstad ogenstad closed this as completed Aug 9, 2024
@exalate-issue-sync exalate-issue-sync bot removed the state/need-triage This issue needs to be triaged label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants