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

Add new format keyword global-unique #195

Open
ajbalogh opened this issue Oct 5, 2021 · 0 comments · May be fixed by #444
Open

Add new format keyword global-unique #195

ajbalogh opened this issue Oct 5, 2021 · 0 comments · May be fixed by #444
Assignees
Labels
priority High Priority spec Impacts API Spec validation Impacts validation logic in SDK
Milestone

Comments

@ajbalogh
Copy link
Contributor

ajbalogh commented Oct 5, 2021

Is your feature request related to a use case? Please describe.

  • Users currently have to add a unique name for every object that has a property documented as being globally unique.
    properties:
      name:
        description: >-
          Globally unique name of an object.
          It also serves as the primary key for arrays of objects.
        type: string
        pattern: ^[\sa-zA-Z0-9-_()><\[\]]+$
    p1, p2 = config.ports.port(name='p1').port(name='p2')
    
    c1 = config.capture.capture(name='c1')
    c1.port_names = [p1.name]

Describe the solution you'd like

# if the user does not specify a name,  one will be generated for them
p1, p2 = config.ports.port().port()
print(p1, p2) # outputs PORT-1 PORT-2
  • Instead of implicit descriptions there should be an explicit string format keyword named global-unique that is documented in the modeling guide
  • The keyword MUST be supported by the python/go ux sdk generators which will generate a unique name if none is provided.
  • The python/go ux sdk generators should generate a named based on the schema object that contains the property, the format of the name MUST be <schema object in uppercase>-<next available int>.
    # python/go sdk generation should produce a default name <schema object name in upper case>-<next available int>
    # i.e., name: PORT-1
    Port:
      type: object
      properties:
        name:
        type: string
        format: global-unique
        pattern: ^[\sa-zA-Z0-9-_()><\[\]]+$    
  • Validation that is part of the python/go ux sdk packages MUST enforce the keyword by ensuring that all properties with a format of global-unique are globally unique.
    properties:
      name:
        description: >-
          Globally unique name of an object.
          It also serves as the primary key for arrays of objects.
        type: string
        format: global-unique
        pattern: ^[\sa-zA-Z0-9-_()><\[\]]+$

Describe alternatives you've considered

The current OpenApi specificiation does not provide any format for indicating a globally unique name.

Additional context

N/A

@ajbalogh ajbalogh self-assigned this Oct 5, 2021
@ajbalogh ajbalogh added enhancement New feature or request go ux sdk gen proto gen Specific to proto file generation labels Oct 5, 2021
@ashutshkumr ashutshkumr added spec Impacts API Spec validation Impacts validation logic in SDK and removed enhancement New feature or request py ux sdk gen proto gen Specific to proto file generation labels Jul 18, 2023
@ashutshkumr ashutshkumr added this to the v1.0.0 milestone Jul 18, 2023
@ashutshkumr ashutshkumr added the priority High Priority label Jul 18, 2023
@ashutshkumr ashutshkumr moved this to Backlog in OTG Tools Jul 18, 2023
@Vibaswan Vibaswan assigned Vibaswan and unassigned ajbalogh Sep 6, 2023
@Vibaswan Vibaswan moved this from Backlog to In Progress in OTG Tools Sep 6, 2023
@Vibaswan Vibaswan linked a pull request Sep 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority High Priority spec Impacts API Spec validation Impacts validation logic in SDK
Projects
Status: In Progress
3 participants