opsmill / infrahub

Infrahub - A new approach to Infrastructure Management
https://opsmill.com/
GNU Affero General Public License v3.0
150 stars 7 forks source link

feature: Add ability to restrict Number kinds to a range in the schema #3634

Closed ogenstad closed 1 month ago

ogenstad commented 1 month ago

Component

API Server / GraphQL

Describe the Feature Request

Currently when an object has a String type in the schema it's possible to control the minimum and maximum length of those strings using the min_length or max_length attribute parameters. This is currently not possible for numbers.

Describe the Use Case

It would be good to be able to specify ranges, i.e for ports 1-65535, or vlans 1-4094, or just an attribute that has to be a positive number or between some other range.

I don't know if we need all combinations such as:

I think one for each boundary would be enough. It might be tempting to reuse the settings from Strings i.e min_length and max_length to avoid having a huge number of options but I think both of those sound wrong for numbers.

Another consideration is if we want to have something for additional restrictions. I'm not sure it's still a thing but at least in the Cisco world the vlans 1002 -> 1005 were reserved and couldn't be used. Do we need an ability to exclude specific ranges? If so how should this be defined?

Additional Information

No response

ogenstad commented 1 month ago

Closing as a duplicate of #2967