Skip to content

Add naming requirements to metadata for _validation of objects #16236

Closed

Description

As part of putting automation on top of the Azure SDK for Python, I found one of the missing pieces of information in the object metadata is the naming rules, for example maximum name length, allowed naming pattern. This information is in the documentation, but not present in the generated code. It would be really nice if the autorest-ed classes could add to validation, for example here is a mocked up example from class Subnet with "name" content and length rules (I made up the content, it is not based on any actual documentation):

      _validation = {
          'etag': {'readonly': True},
          'name': {'max_length': 64, 'regex': ...},
          'private_endpoints': {'readonly': True},
          'ip_configurations': {'readonly': True},
          'ip_configuration_profiles': {'readonly': True},
          'resource_navigation_links': {'readonly': True},
          'service_association_links': {'readonly': True},
          'purpose': {'readonly': True},
          'provisioning_state': {'readonly': True},
      }

One reason I would like this is to automatically compress and disambiguate names to improve automation success. For example, some objects have a max name length of 64, some 80, some 16. The process of fixing up those names to conform is much easier if the SDK advertises what the naming rules are. And yes, even if this is in a "private" variable, it's still incredibly useful to consume for automation.

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

Metadata

Assignees

No one assigned

    Labels

    issue-addressedWorkflow: The Azure SDK team believes it to be addressed and ready to close.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions