LinkedSoftwareDependencies / Components-Generator.js

⚙️ Generate Components.js component files from TypeScript
13 stars 7 forks source link

@range {json} only works with Record #88

Open joachimvh opened 2 years ago

joachimvh commented 2 years ago

Using version 3.0.0-beta.7

  /**
   * @param response - @range {json}
   */
  public constructor(response: any) {

(or unknown) results in JSON-LD

      "parameters": [
        {
          "@id": "scs:dist/identity/interaction/FixedInteractionHandler.jsonld#FixedInteractionHandler_response",
          "range": {
            "@type": "ParameterRangeWildcard"
          }
        }
      ],

When using Record

  /**
   * @param response - @range {json}
   */
  public constructor(response: Record<string, unknown>) {

I do get

      "parameters": [
        {
          "@id": "scs:dist/identity/interaction/FixedInteractionHandler.jsonld#FixedInteractionHandler_response",
          "range": "rdf:JSON"
        }
      ],

Similar to #87, in case this is expected behaviour, the context does not get type: @json.

rubensworks commented 2 years ago

Right, these needs to be changed here: https://github.com/LinkedSoftwareDependencies/Components-Generator.js/blob/feature/strict-type-checking/lib/parse/ParameterLoader.ts#L531-L568