Skip to content

Resolve relations to referenced resources when references follow a na…#5

Open
phfeustel wants to merge 1 commit intonlohmann:masterfrom
phfeustel:feature/resolve_relations_to_referenced_resources_by_naming_convention
Open

Resolve relations to referenced resources when references follow a na…#5
phfeustel wants to merge 1 commit intonlohmann:masterfrom
phfeustel:feature/resolve_relations_to_referenced_resources_by_naming_convention

Conversation

@phfeustel
Copy link
Contributor

…ming convention.

Example: A theater play has serveral character roles. When creating or updating a role resource I want to include the back reference from role to play also in the payload. But I don't want to send the whole play payload. To model this relation I set the playResourceId within the role resource.
I want this relation to be reflected also in my UML diagrams but cannot $ref the play resource in role because this would include the complete play resource JSON in role. That's why I just use the playResourceId.

To be able to reflect this relationship in the UML I propose to search for ResouceId in the format string endings of the referencing resource. If found, a relation between the referencing and the referenced resource (role and play) in this case is created.

  Play:
    type: object
    properties:
      id:
        type: string
        format: uuid
      title:
        type: string
  Role:
    type: object
    properties:
      id:
        type: string
        format: uuid
      title:
        type: string
      playId:
        type: string
        format: playResourceId

Creates:

class Play {
    {field} string (uuid) id
    {field} string title
}
class Role {
    {field} string (uuid) id
    {field} string title
    {field} string (playResourceId) playId
}

Role ..> Play

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

Successfully merging this pull request may close these issues.

1 participant