bug: infrahubctl schema load/check returns error message "invalid literal for int() with base 10: 'nodes'" when you define an attribute wihtout specifying a kind as a node extension #4009
When you load a schema file with a node extension, that defines an attribute for an existing node without specifying a kind, it returns an error message:
Unable to load the schema:
invalid literal for int() with base 10: 'nodes'
Expected Behavior
A more precise error message is returned that explains what is wrong with the schema you are trying to load.
Steps to Reproduce
spin up infrahub
load the demo schema inv demo.load-infra-schema
save the following schema file to your filesystem
---
version: '1.0'
nodes:
- name: DeviceType
namespace: Infra
description: "A model of device"
label: "Device Type"
icon: "mdi:poll"
default_filter: name__value
display_labels:
- name__value
order_by:
- manufacturer__name__value
- name__value
uniqueness_constraints:
- ["manufacturer", "name__value"]
attributes:
- name: name
kind: Text
unique: true
order_weight: 1000
- name: description
kind: Text
optional: true
order_weight: 1100
- name: part_number
label: Part Number
optional: true
kind: Text
order_weight: 1200
- name: height
label: "Height (U)"
optional: true
kind: Number
order_weight: 1400
- name: full_depth
label: "Full Depth"
default_value: true
kind: Boolean
order_weight: 1500
- name: eol_date
label: "EOL Date"
kind: DateTime
order_weight: 1600
- name: weight
label: "Weight (kg)"
optional: true
kind: Number
order_weight: 1700
relationships:
- name: platform
peer: InfraPlatform
cardinality: one
kind: Attribute
order_weight: 1300
- name: manufacturer
peer: OrganizationManufacturer
cardinality: one
kind: Attribute
order_weight: 1250
optional: false
- name: tags
peer: BuiltinTag
optional: true
cardinality: many
kind: Attribute
order_weight: 2000
extensions:
nodes:
- kind: InfraDevice
attributes:
- name: new
- name: type
kind: Text
state: absent
relationships:
- name: type
peer: InfraDeviceType
kind: Attribute
optional: false
cardinality: many
perform a schema check using infrahubctl infrahubctl schema check ../path/to/file.yml
Component
API Server / GraphQL, Python SDK
Infrahub version
0.16.0.dev0
Current Behavior
When you load a schema file with a node extension, that defines an attribute for an existing node without specifying a kind, it returns an error message:
Expected Behavior
A more precise error message is returned that explains what is wrong with the schema you are trying to load.
Steps to Reproduce
inv demo.load-infra-schema
infrahubctl schema check ../path/to/file.yml
Additional Information
No response