diff --git a/helpers/all.js b/helpers/all.js index 732fbb6c6..efff21037 100644 --- a/helpers/all.js +++ b/helpers/all.js @@ -33,7 +33,7 @@ function mergeInto(from, to) { * Prepares configuration for component. */ export function prepareConfiguration(params = {}) { - const config = { show: { sidebar: false }, sidebar: { showOperations: 'byDefault' } }; + const config = { show: { sidebar: true }, sidebar: { showOperations: 'byDefault' } }; // Apply config override if (params.config) { let configOverride; diff --git a/package-lock.json b/package-lock.json index c7d627d4f..95aed107f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@asyncapi/generator-react-sdk": "^1.0.0", "@asyncapi/parser": "^3.0.0-next-major-spec.2", - "@asyncapi/react-component": "^1.0.0-next.53", + "@asyncapi/react-component": "^1.0.0-next.54", "highlight.js": "10.7.3", "puppeteer": "^14.1.0", "react-dom": "^17.0.2", @@ -656,9 +656,9 @@ } }, "node_modules/@asyncapi/react-component": { - "version": "1.0.0-next.53", - "resolved": "https://registry.npmjs.org/@asyncapi/react-component/-/react-component-1.0.0-next.53.tgz", - "integrity": "sha512-r0zHFlIn5sgPZzdCgQnaRCtTcAt2UlmT/uzYtiUehkhVxk5gwuUcRHKcZxcX/zSdn8ZaEBa4708hqnoXVa6wNw==", + "version": "1.0.0-next.54", + "resolved": "https://registry.npmjs.org/@asyncapi/react-component/-/react-component-1.0.0-next.54.tgz", + "integrity": "sha512-ign7m7Pt+xQEiYdcA/pABC/Qxpl9lILs3utNTjivEstL5zb2RprQpotHwWmZDLmvbHlmycD3n34xhfoFkRUmHA==", "dependencies": { "@asyncapi/avro-schema-parser": "3.0.3", "@asyncapi/openapi-schema-parser": "3.0.4", diff --git a/package.json b/package.json index 9c39c60e2..13b50a942 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "@asyncapi/generator-react-sdk": "^1.0.0", - "@asyncapi/react-component": "^1.0.0-next.53", + "@asyncapi/react-component": "^1.0.0-next.54", "@asyncapi/parser": "^3.0.0-next-major-spec.2", "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 d18f3141a..17c43ac02 100644 --- a/test/components/__snapshots__/index.test.js.snap +++ b/test/components/__snapshots__/index.test.js.snap @@ -14,7 +14,92 @@ exports[`Index component should render AsyncAPI v2 document 1`] = ` -
+
Streetlights API 1.0.0

The Smartylighting Streetlights API allows you to remotely manage the city lights.

+

Check out its awesome features:

+
    +
  • Turn a specific streetlight on/off 🌃
  • +
  • Dim a specific streetlight 😎
  • +
  • Receive real-time information about environmental lighting conditions 📈
  • +
+

Servers

  • mqtt://test.mosquitto.org:{port}mqttproduction

    Test broker

    +
    object
    port
    required
    string

    Secure connection (TLS) is available through port 8883.

    +
    Default value:"1883"
      Allowed values:
    • "1883"
    • "8883"

Operations

  • SUB smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured

    The topic on which measured values may be produced and consumed.

    +

    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
    clientId
    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
    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,
    +  \\"sentAt\\": \\"2019-08-24T14:15:22Z\\"
    +}
    +
    +
    This example has been generated automatically.
    {
    +  \\"my-app-header\\": 100
    +}
    +
    +
    This example has been generated automatically.
  • PUB smartylighting/streetlights/1/0/action/{streetlightId}/turn/on

    Operation IDturnOn

    Available only on servers:

    object
    streetlightId
    required
    string

    The ID of the streetlight.

    +
    object
    clientId
    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.

    +
      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\\",
    +  \\"sentAt\\": \\"2019-08-24T14:15:22Z\\"
    +}
    +
    +
    This example has been generated automatically.
    {
    +  \\"my-app-header\\": 100
    +}
    +
    +
    This example has been generated automatically.
  • PUB smartylighting/streetlights/1/0/action/{streetlightId}/turn/off

    Operation IDturnOff

    Available only on servers:

    object
    streetlightId
    required
    string

    The ID of the streetlight.

    +
    object
    clientId
    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.

    +
      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\\",
    +  \\"sentAt\\": \\"2019-08-24T14:15:22Z\\"
    +}
    +
    +
    This example has been generated automatically.
    {
    +  \\"my-app-header\\": 100
    +}
    +
    +
    This example has been generated automatically.
  • PUB smartylighting/streetlights/1/0/action/{streetlightId}/dim

    Operation IDdimLight

    Available only on servers:

    object
    streetlightId
    required
    string

    The ID of the streetlight.

    +
    object
    clientId
    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.

    +
    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,
    +  \\"sentAt\\": \\"2019-08-24T14:15:22Z\\"
    +}
    +
    +
    This example has been generated automatically.
    {
    +  \\"my-app-header\\": 100
    +}
    +
    +
    This example has been generated automatically.
  • PUB some.channel

    this description shows in markdown

    +
    Operation IDsubscribe

    Available only on servers:

    Accepts one of the following messages:

    • #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
        {
        +  \\"error\\": {
        +    \\"errorCode\\": 404,
        +    \\"errorMessage\\": \\"Something messed up\\"
        +  }
        +}
        +
        +

Messages

  • #1Light measuredlightMeasured

    Inform about environmental lighting conditions of a particular streetlight.

    Message IDlightMeasured
    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.

  • #2Turn on/offturnOnOff

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

    Message IDturnOnOff
    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.

  • #3Dim lightdimLight

    Command a particular streetlight to dim the lights.

    Message IDdimLight
    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.

  • #4successMessage
    Message IDsuccessMessage
    object
    result
    string
      Examples values:
    • "success"

    Additional properties are allowed.

  • #5failureMessage
    Message IDfailureMessage
    object
      Examples values:
    • {"error":{"errorCode":404,"errorMessage":"Something messed up"}}
    object
    errorCode
    integer
    errorMessage
    string

    Additional properties are allowed.

    Additional properties are allowed.

Schemas

  • 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
    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
    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.

  • sentAt
    string
    format: date-time

    Date and time when the message was sent.

    +
@@ -468,7 +553,77 @@ exports[`Index component should render AsyncAPI v3 document 1`] = ` -
+
Adeo AsyncAPI Case Study %REPLACED_BY_MAVEN%

This Adeo specification illustrates how ADEO uses AsyncAPI to document some of their exchanges

+
  • #costing

Servers

  • kafka-secure://prod.url:9092/kafka-secureproduction

    Kafka PRODUCTION cluster

    +
    Security:
    object
    schemaRegistryUrl
    https://schema-registry.prod.url/
  • kafka-secure://staging.url:9092/kafka-securestaging

    Kafka STAGING cluster for uat and preprod environments

    +
    Security:
    object
    schemaRegistryUrl
    https://schema-registry.staging.url/
  • kafka-secure://dev.url:9092/kafka-securedev

    Kafka DEV cluster for dev and sit environments

    +
    Security:
    object
    schemaRegistryUrl
    https://schema-registry.dev.url/

Operations

  • SUB adeo-{env}-case-study-COSTING-REQUEST-{version}

    Use this topic to do a Costing Request to Costing product. We use the RecordNameStrategy to infer the messages schema. You have to define x-value.subject.name.strategy to io.confluent.kafka.serializers.subject.RecordNameStrategy in your producer to use the schema we manage. The schema below illustrates how Costing Request messages are handled. \\"\\"

    +

    [COSTING] Request one or more Costing calculation for any product +

    You can try a costing request using our Conduktor producer template

    +
    Operation IDrequestCosting

    Available only on servers:

    object
    env
    required
    string

    Adeo Kafka Environment for messages publications.

    +
      Allowed values:
    • "dev"
    • "sit"
    • "uat1"
    • "preprod"
    • "prod"
    version
    required
    string

    the topic version you want to use

    +
    Default value:"V1"
      Examples values:
    • "V1"
    object
    replicas
    3
    partitions
    3
    object
    tuple<string, ...optional<any>>
    1 item:
    delete
    retention.ms
    604800000
    object
    groupId
    string

    The groupId must be prefixed by your svc account, deliver by the Adeo Kafka team. This svc must have the write access to the topic.

    +
    x-value.subject.name.strategy
    string

    We use the RecordNameStrategy to infer the messages schema. Use x-value.subject.name.strategy=io.confluent.kafka.serializers.subject.RecordNameStrategy in your producer configuration.

    +
    • #costing

    Accepts the following message:

    Costing Request V1costingRequest

    Costing Request V1 inputs.

    Message IDcostingRequest
    Correlation ID$message.header#/REQUEST_ID

    This correlation ID is used for message tracing and messages correlation. This correlation ID is generated at runtime based on the REQUEST_ID and sent to the RESPONSE message.

    +
    Payload
    record
    object
    REQUEST_ID
    required
    string
    format: uuid

    A unique Request ID needed to define a CORRELATION_ID for exchanges, which will be sent back in the Costing Responses.

    +
    REPLY_TOPIC
    required
    string

    The Kafka topic where to send the Costing Response. This is required for the Return Address EIP pattern. You must grant WRITE access to our svc-ccr-app service account.

    +
    REQUESTER_ID
    required
    string

    The Costing requester service account used to produce costing request.

    +
    REQUESTER_CODE
    required
    string

    The Costing requester code (generally the BU Code). The requester code is useful to get the dedicated context (tenant).

    +

    Additional properties are allowed.

    • #costing

    Examples

    This example has been generated automatically.
    {
    +  \\"REQUEST_ID\\": \\"1fa6ef40-8f47-40a8-8cf6-f8607d0066ef\\",
    +  \\"REPLY_TOPIC\\": \\"adeo-case-study-COSTING-RESPONSE-V1\\",
    +  \\"REQUESTER_ID\\": \\"svc-ecollect-app\\",
    +  \\"REQUESTER_CODE\\": 1
    +}
    +
    +
    This example has been generated automatically.
  • PUB adeo-{env}-case-study-COSTING-RESPONSE-{version}

    This topic is used to REPLY Costing Requests and is targeted by the REPLY_TOPIC header. You must grant PUBLISH access to our svc-ccr-app service account.. We use the RecordNameStrategy to infer the messages schema. You have to define key.subject.name.strategy and x-value.subject.name.strategy to io.confluent.kafka.serializers.subject.RecordNameStrategy in your consumer. The schema below illustrates how Costing Response messages are handled. + \\"\\"

    +

    [COSTING] Get the costing responses matching an initial Costing Request. +

    Operation IDgetCostingResponse

    Available only on servers:

    object
    env
    required
    string

    Adeo Kafka Environment for messages publications.

    +
      Allowed values:
    • "dev"
    • "sit"
    • "uat1"
    • "preprod"
    • "prod"
    version
    required
    string

    the topic version you want to use

    +
    Default value:"V1"
      Examples values:
    • "V1"
    object
    x-key.subject.name.strategy
    string

    We use the RecordNameStrategy to infer the messages schema. Use x-key.subject.name.strategy=io.confluent.kafka.serializers.subject.RecordNameStrategy in your consumer configuration.

    +
    x-value.subject.name.strategy
    string

    We use the RecordNameStrategy to infer the messages schema. Use x-value.subject.name.strategy=io.confluent.kafka.serializers.subject.RecordNameStrategy in your consumer configuration.

    +
    object
    groupId
    string

    The groupId must be prefixed by your svc account, deliver by the Adeo Kafka team. This svc must have the read access to the topic.

    +
    • #costing

    Accepts the following message:

    Costing ResponsecostingResponse

    Costing Response ouputs.

    Message IDcostingResponse
    Correlation ID$message.header#/REQUEST_ID

    This correlation ID is used for message tracing and messages correlation. This correlation ID is generated at runtime based on the REQUEST_ID and sent to the RESPONSE message.

    +

    Please refer to the CostingResponseKey.avsc schema, available on our github project.

    +
    Payload
    record
    object
    CALCULATION_ID
    string
    format: uuid

    A unique Message ID.

    +
    CORRELATION_ID
    string
    format: uuid

    A unique Correlation ID defined from the REQUEST_ID or the MESSAGE_ID provided in the Costing Request.

    +
    REQUEST_TIMESTAMP
    string
    format: date-time

    Timestamp of the costing request

    +
    CALCULATION_TIMESTAMP
    string
    format: date-time

    Technical timestamp for the costing calculation

    +

    Additional properties are allowed.

    • #costing

    Examples

    This example has been generated automatically.
    {
    +  \\"CALCULATION_ID\\": \\"1fa6ef40-8f47-40a8-8cf6-f8607d0066ef\\",
    +  \\"CORRELATION_ID\\": \\"1fa6ef40-8f47-40a8-8cf6-f8607d0066ef\\",
    +  \\"REQUEST_TIMESTAMP\\": \\"2019-08-24T14:15:22Z\\",
    +  \\"CALCULATION_TIMESTAMP\\": \\"2019-08-24T14:15:22Z\\"
    +}
    +
    +
    This example has been generated automatically.

Messages

  • #1Costing Request V1costingRequestV1

    Costing Request V1 inputs.

    Message IDcostingRequestV1
    Correlation ID$message.header#/REQUEST_ID

    This correlation ID is used for message tracing and messages correlation. This correlation ID is generated at runtime based on the REQUEST_ID and sent to the RESPONSE message.

    +
    Payload
    record
    object
    REQUEST_ID
    required
    string
    format: uuid

    A unique Request ID needed to define a CORRELATION_ID for exchanges, which will be sent back in the Costing Responses.

    +
    REPLY_TOPIC
    required
    string

    The Kafka topic where to send the Costing Response. This is required for the Return Address EIP pattern. You must grant WRITE access to our svc-ccr-app service account.

    +
    REQUESTER_ID
    required
    string

    The Costing requester service account used to produce costing request.

    +
    REQUESTER_CODE
    required
    string

    The Costing requester code (generally the BU Code). The requester code is useful to get the dedicated context (tenant).

    +

    Additional properties are allowed.

    • #costing
  • #2Costing ResponsecostingResponse

    Costing Response ouputs.

    Message IDcostingResponse
    Correlation ID$message.header#/REQUEST_ID

    This correlation ID is used for message tracing and messages correlation. This correlation ID is generated at runtime based on the REQUEST_ID and sent to the RESPONSE message.

    +

    Please refer to the CostingResponseKey.avsc schema, available on our github project.

    +
    Payload
    record
    object
    CALCULATION_ID
    string
    format: uuid

    A unique Message ID.

    +
    CORRELATION_ID
    string
    format: uuid

    A unique Correlation ID defined from the REQUEST_ID or the MESSAGE_ID provided in the Costing Request.

    +
    REQUEST_TIMESTAMP
    string
    format: date-time

    Timestamp of the costing request

    +
    CALCULATION_TIMESTAMP
    string
    format: date-time

    Technical timestamp for the costing calculation

    +

    Additional properties are allowed.

    • #costing

Schemas

  • RequesterId
    string

    The Costing requester service account used to produce costing request.

    +
  • RequesterCode
    string

    The Costing requester code (generally the BU Code). The requester code is useful to get the dedicated context (tenant).

    +
  • MessageId
    string
    format: uuid

    A unique Message ID.

    +
  • RequestId
    string
    format: uuid

    A unique Request ID needed to define a CORRELATION_ID for exchanges, which will be sent back in the Costing Responses.

    +
  • CorrelationId
    string
    format: uuid

    A unique Correlation ID defined from the REQUEST_ID or the MESSAGE_ID provided in the Costing Request.

    +
  • BuCode
    string

    The Business Unit code for which data are applicable.

    +
  • ReplyTopic
    string

    The Kafka topic where to send the Costing Response. This is required for the Return Address EIP pattern. You must grant WRITE access to our svc-ccr-app service account.

    +
  • ErrorStep
    string

    The woker that has thrown the error.

    +
  • ErrorMessage
    string

    The error message describing the error.

    +
  • ErrorCode
    string

    The error code.

    +