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

foreign key in x-composite-index #353

Open
Arzemn opened this issue Jul 13, 2021 · 0 comments
Open

foreign key in x-composite-index #353

Arzemn opened this issue Jul 13, 2021 · 0 comments

Comments

@Arzemn
Copy link

Arzemn commented Jul 13, 2021

As a user I want to have the ability to add a foreign key to an x-composite-index

Currently when adding a foreign key into the x-composite-index it generates a key error at the composite index creation step

Example:

ProjectDB:
      description: Basic Project Row
      type: object
      x-tablename: project
      properties:
        id:
          type: integer
          description: Unique identifier for the project 
          example: 0
          x-primary-key: true
          x-autoincrement: true
       project_id:
          type: integer
          description: Unique identifier for the project to the Server   
        server_id:
          $ref: "#/components/schemas/ServerDB"
       x-composite-index:
          - project_id
          - server_id

Results in

KeyError: 'server_id'

Even attempting to use the underlying foreign key "server_id_id" fails

 x-composite-index:
          - project_id
          - server_id_id

Result

open_alchemy.exceptions.MalformedSchemaError: ProjectDB :: x-composite-index :: all expressions must be properties, server_id_id is not

only way to overcome is to define the relation manually,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant