From 285653a070c59303475988c6440afa95cae7a3f8 Mon Sep 17 00:00:00 2001 From: Khuda Dad Nomani <32505158+KhudaDad414@users.noreply.github.com> Date: Tue, 26 Mar 2024 08:41:18 +0000 Subject: [PATCH] fix: use latest JavaScript Parser version (#574) --- package-lock.json | 16 +++--- package.json | 2 +- .../__snapshots__/index.test.js.snap | 54 ++++++++++++------- 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2ec191a0f..38c1f7093 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@asyncapi/generator-react-sdk": "^1.0.9", - "@asyncapi/parser": "^3.0.5", + "@asyncapi/parser": "^3.0.10", "@asyncapi/react-component": "^1.2.13", "highlight.js": "10.7.3", "puppeteer": "^14.1.0", @@ -464,11 +464,11 @@ } }, "node_modules/@asyncapi/parser": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.5.tgz", - "integrity": "sha512-Kc/hwCyb2/YzcIfQlY9lwjUDV/9cXMjVewQz9WvPVAaFlOr83bdHpccfnl2sQNXDcC+zCcpEDBjs41ATowPE3Q==", + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.10.tgz", + "integrity": "sha512-x9qo7SHGzPWbC1XCRyilcI+Z6UZsWZ9uRl05h9j4G/v+3IjNG3krwngiAbt59nbLlYZD/nBS7Hc03GayoocnQw==", "dependencies": { - "@asyncapi/specs": "^6.4.0", + "@asyncapi/specs": "^6.5.3", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", "@stoplight/json": "^3.20.2", "@stoplight/json-ref-readers": "^1.2.2", @@ -578,9 +578,9 @@ } }, "node_modules/@asyncapi/specs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.4.0.tgz", - "integrity": "sha512-hTw0xF09i+eoSGP8LKo6aM+XOkvWsgV7kYpFHXd45VX9RcVZl5cADFIYDnPZkd52WaDJ4S+8Nrwkt/1vDb6SrQ==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.5.3.tgz", + "integrity": "sha512-mZROlCOLkZEWy5tN4pPop3JEJflSKmLLMGO1TebF5wjnroqZ3yp/GuGUxVIl3jVNxFk1i5nZ2AtWzAD/HaUj3Q==", "dependencies": { "@types/json-schema": "^7.0.11" } diff --git a/package.json b/package.json index 5c7abf2b3..b19bfa04b 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@asyncapi/generator-react-sdk": "^1.0.9", - "@asyncapi/parser": "^3.0.5", + "@asyncapi/parser": "^3.0.10", "@asyncapi/react-component": "^1.2.13", "highlight.js": "10.7.3", "puppeteer": "^14.1.0", diff --git a/test/components/__snapshots__/index.test.js.snap b/test/components/__snapshots__/index.test.js.snap index 815650dd7..2530cc26f 100644 --- a/test/components/__snapshots__/index.test.js.snap +++ b/test/components/__snapshots__/index.test.js.snap @@ -479,7 +479,7 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `

Inform about environmental lighting conditions of a particular streetlight.

This is the description with bold text.

On multiple lines.

Operation IDreceiveLightMeasurement

Available only on servers:

object
streetlightId
required
string

The ID of the streetlight.

-
object
object
const
my-app-id

Accepts the following message:

Light measured

Inform about environmental lighting conditions of a particular streetlight.

object
integer
>= 0

Light intensity measured in lumens.

+
object
object
const
my-app-id

Accepts the following message:

Light measuredreceiveLightMeasurement.message

Inform about environmental lighting conditions of a particular streetlight.

Message IDreceiveLightMeasurement.message
object
integer
>= 0

Light intensity measured in lumens.

object
x-pi
false
sentAt
string
format: date-time

Date and time when the message was sent.

Additional properties are allowed.

object
my-app-header
integer
[ 0 .. 100 ]

Additional properties are allowed.

Examples

{
   \\"lumens\\": 0,
@@ -491,7 +491,7 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
 }
 
This example has been generated automatically.
  • SEND smartylighting/streetlights/1/0/action/{streetlightId}/turn/on

    Operation IDturnOn

    Available only on servers:

    object
    streetlightId
    required
    string

    The ID of the streetlight.

    -
    object
    object
    const
    my-app-id

    Accepts the following message:

    Turn on/off

    Command a particular streetlight to turn the lights on or off.

    object
    string

    Whether to turn on or off the light.

    +
    object
    object
    const
    my-app-id

    Accepts the following message:

    Turn on/offturnOn.message

    Command a particular streetlight to turn the lights on or off.

    Message IDturnOn.message
    object
    string

    Whether to turn on or off the light.

      Allowed values:
    • "on"
    • "off"
    object
    x-pi
    false
    sentAt
    string
    format: date-time

    Date and time when the message was sent.

    Additional properties are allowed.

    object
    my-app-header
    integer
    [ 0 .. 100 ]

    Additional properties are allowed.

    Examples

    {
       \\"command\\": \\"on\\",
    @@ -503,7 +503,7 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
     }
     
    This example has been generated automatically.
  • SEND smartylighting/streetlights/1/0/action/{streetlightId}/turn/off

    Operation IDturnOff

    Available only on servers:

    object
    streetlightId
    required
    string

    The ID of the streetlight.

    -
    object
    object
    const
    my-app-id

    Accepts the following message:

    Turn on/off

    Command a particular streetlight to turn the lights on or off.

    object
    string

    Whether to turn on or off the light.

    +
    object
    object
    const
    my-app-id

    Accepts the following message:

    Turn on/offturnOn.message

    Command a particular streetlight to turn the lights on or off.

    Message IDturnOn.message
    object
    string

    Whether to turn on or off the light.

      Allowed values:
    • "on"
    • "off"
    object
    x-pi
    false
    sentAt
    string
    format: date-time

    Date and time when the message was sent.

    Additional properties are allowed.

    object
    my-app-header
    integer
    [ 0 .. 100 ]

    Additional properties are allowed.

    Examples

    {
       \\"command\\": \\"on\\",
    @@ -515,7 +515,7 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
     }
     
    This example has been generated automatically.
  • SEND smartylighting/streetlights/1/0/action/{streetlightId}/dim

    Operation IDdimLight

    Available only on servers:

    object
    streetlightId
    required
    string

    The ID of the streetlight.

    -
    object
    object
    const
    my-app-id

    Accepts the following message:

    Dim light

    Command a particular streetlight to dim the lights.

    object
    percentage
    integer
    [ 0 .. 100 ]

    Percentage to which the light should be dimmed to.

    +
    object
    object
    const
    my-app-id

    Accepts the following message:

    Dim lightdimLight.message

    Command a particular streetlight to dim the lights.

    Message IDdimLight.message
    object
    percentage
    integer
    [ 0 .. 100 ]

    Percentage to which the light should be dimmed to.

    sentAt
    string
    format: date-time

    Date and time when the message was sent.

    Additional properties are allowed.

    object
    my-app-header
    integer
    [ 0 .. 100 ]

    Additional properties are allowed.

    Examples

    {
       \\"percentage\\": 100,
    @@ -527,11 +527,11 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
     }
     
    This example has been generated automatically.
  • SEND some.channel

    this description shows in markdown

    -
    Operation IDsome.channel.subscribe

    Available only on servers:

    Accepts one of the following messages:

    • #0
      object
      result
      string
        Examples values:
      • "success"

      Additional properties are allowed.

      Examples

      {
      +
      Operation IDsome.channel.subscribe

      Available only on servers:

      Accepts one of the following messages:

      • #0subscribe.message.0
        Message IDsubscribe.message.0
        object
        result
        string
          Examples values:
        • "success"

        Additional properties are allowed.

        Examples

        {
           \\"result\\": \\"success\\"
         }
         
        -
        This example has been generated automatically.
      • #1
        object
          Examples values:
        • {"error":{"errorCode":404,"errorMessage":"Something messed up"}}
        object
        errorCode
        integer
        errorMessage
        string

        Additional properties are allowed.

        Additional properties are allowed.

        Examples

        • #1 Example
          {
          +
          This example has been generated automatically.
      • #1subscribe.message.1
        Message IDsubscribe.message.1
        object
          Examples values:
        • {"error":{"errorCode":404,"errorMessage":"Something messed up"}}
        object
        errorCode
        integer
        errorMessage
        string

        Additional properties are allowed.

        Additional properties are allowed.

        Examples

        • #1 Example
          {
             \\"error\\": {
               \\"errorCode\\": 404,
               \\"errorMessage\\": \\"Something messed up\\"
          @@ -669,7 +669,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                         }
                       },
                       \\"x-parser-schema-id\\": \\"\\"
          -          }
          +          },
          +          \\"x-parser-unique-object-id\\": \\"receiveLightMeasurement.message\\"
                   }
                 },
                 \\"description\\": \\"The topic on which measured values may be produced and consumed.\\",
          @@ -723,7 +724,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                         }
                       },
                       \\"x-parser-schema-id\\": \\"\\"
          -          }
          +          },
          +          \\"x-parser-unique-object-id\\": \\"turnOn.message\\"
                   }
                 },
                 \\"parameters\\": {
          @@ -781,7 +783,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                         }
                       },
                       \\"x-parser-schema-id\\": \\"\\"
          -          }
          +          },
          +          \\"x-parser-unique-object-id\\": \\"dimLight.message\\"
                   }
                 },
                 \\"parameters\\": {
          @@ -806,7 +809,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                         }
                       },
                       \\"x-parser-schema-id\\": \\"\\"
          -          }
          +          },
          +          \\"x-parser-unique-object-id\\": \\"subscribe.message.0\\"
                   },
                   \\"subscribe.message.1\\": {
                     \\"name\\": \\"Failure\\",
          @@ -837,7 +841,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                         }
                       ],
                       \\"x-parser-schema-id\\": \\"\\"
          -          }
          +          },
          +          \\"x-parser-unique-object-id\\": \\"subscribe.message.1\\"
                   }
                 },
                 \\"x-parser-unique-object-id\\": \\"some.channel\\"
          @@ -888,7 +893,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                             \\"description\\": \\"Date and time when the message was sent.\\"
                           }
                         }
          -            }
          +            },
          +            \\"x-parser-unique-object-id\\": \\"receiveLightMeasurement.message\\"
                     }
                   },
                   \\"description\\": \\"The topic on which measured values may be produced and consumed.\\",
          @@ -943,7 +949,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                 ],
                 \\"messages\\": [
                   \\"$ref:$.channels.smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured.messages.receiveLightMeasurement.message\\"
          -      ]
          +      ],
          +      \\"x-parser-unique-object-id\\": \\"receiveLightMeasurement\\"
               },
               \\"turnOn\\": {
                 \\"bindings\\": {
          @@ -987,7 +994,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                             \\"description\\": \\"Date and time when the message was sent.\\"
                           }
                         }
          -            }
          +            },
          +            \\"x-parser-unique-object-id\\": \\"turnOn.message\\"
                     }
                   },
                   \\"parameters\\": {
          @@ -1002,7 +1010,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                 ],
                 \\"messages\\": [
                   \\"$ref:$.channels.smartylighting/streetlights/1/0/action/{streetlightId}/turn/on.messages.turnOn.message\\"
          -      ]
          +      ],
          +      \\"x-parser-unique-object-id\\": \\"turnOn\\"
               },
               \\"turnOff\\": {
                 \\"bindings\\": {
          @@ -1046,7 +1055,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                             \\"description\\": \\"Date and time when the message was sent.\\"
                           }
                         }
          -            }
          +            },
          +            \\"x-parser-unique-object-id\\": \\"turnOn.message\\"
                     }
                   },
                   \\"parameters\\": {
          @@ -1061,7 +1071,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                 ],
                 \\"messages\\": [
                   \\"$ref:$.channels.smartylighting/streetlights/1/0/action/{streetlightId}/turn/on.messages.turnOn.message\\"
          -      ]
          +      ],
          +      \\"x-parser-unique-object-id\\": \\"turnOff\\"
               },
               \\"dimLight\\": {
                 \\"bindings\\": {
          @@ -1105,7 +1116,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                             \\"description\\": \\"Date and time when the message was sent.\\"
                           }
                         }
          -            }
          +            },
          +            \\"x-parser-unique-object-id\\": \\"dimLight.message\\"
                     }
                   },
                   \\"parameters\\": {
          @@ -1120,7 +1132,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                 ],
                 \\"messages\\": [
                   \\"$ref:$.channels.smartylighting/streetlights/1/0/action/{streetlightId}/dim.messages.dimLight.message\\"
          -      ]
          +      ],
          +      \\"x-parser-unique-object-id\\": \\"dimLight\\"
               },
               \\"some.channel.subscribe\\": {
                 \\"action\\": \\"send\\",
          @@ -1129,7 +1142,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
                 \\"messages\\": [
                   \\"$ref:$.channels.some.channel.messages.subscribe.message.0\\",
                   \\"$ref:$.channels.some.channel.messages.subscribe.message.1\\"
          -      ]
          +      ],
          +      \\"x-parser-unique-object-id\\": \\"some.channel.subscribe\\"
               }
             },
             \\"components\\": {