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

Properly generate $ref types on nodes, interfaces #486

Open
willosborne opened this issue Oct 17, 2024 · 0 comments
Open

Properly generate $ref types on nodes, interfaces #486

willosborne opened this issue Oct 17, 2024 · 0 comments
Assignees
Labels
CLI Generator Pattern Instantiation Generator

Comments

@willosborne
Copy link
Member

Feature Request

Description of Problem:

Currently the generator can generate arrays, strings, integers, consts properly. But if you have a schema with a $ref to a type, it just outputs {{ REF_[ key name ] }} and doesn't recursively instantiate.

For example, generating an interface that is based on the rate-limit-interface defined here. The usage example is the following. Note that only the interfaces are shown for brevity:

{
    "$ref": "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/interface.json#/defs/rate-limit-interface",
    "type": "object",
    "properties": {
        "unique-id": {
            "const": "rate-limit-info"
        }
    }
}
{
          "unique-id": "unique-id-here",
          "key": "{{ REF_KEY }}",
          "time": -1,
          "time-unit": "{{ REF_TIME_UNIT }}",
          "calls": -1
 }

You can see key is a flat string that contains none of the structure of the real definititon.
What this should look like is:

{
    "key": {
        "rate-limit-key": "{{ RATE_LIMIT_KEY }}"
    }
}

This is really confusing because it implies it's just a single field, not an object - and obscures optional/additional fields.

Potential Solutions:

We can already do this recursive instantiation for metadata objects.
A relatively simple solution would be to unify the instantiation code to all use the generic/recursive system which would then bring these benefits to nodes and relationships.
Note that we would still need to keep the node/relationship-specific logic and merge the final objects together.

@willosborne willosborne self-assigned this Oct 25, 2024
@willosborne willosborne added CLI Generator Pattern Instantiation Generator labels Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Oct 25, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 14, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 14, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 14, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 14, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 14, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 14, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 14, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 18, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 18, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 18, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 18, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 18, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 18, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 18, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 21, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 21, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 21, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 21, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 21, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 21, 2024
willosborne added a commit to willosborne/architecture-as-code that referenced this issue Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Generator Pattern Instantiation Generator
Projects
None yet
Development

No branches or pull requests

1 participant