diff --git a/helpers/all.js b/helpers/all.js index f1a4782ac..2a14b69cb 100644 --- a/helpers/all.js +++ b/helpers/all.js @@ -3,7 +3,7 @@ import fs from 'fs'; import ReactDOMServer from 'react-dom/server'; import fetch from 'sync-fetch'; import AsyncApiComponent, { hljs } from '@asyncapi/react-component'; -import { AsyncAPIDocumentInterface } from '@asyncapi/parser'; +import { AsyncAPIDocumentInterface, stringify } from '@asyncapi/parser'; function isJsonObject(o) { return o && typeof o === 'object' && !Array.isArray(o); @@ -133,7 +133,7 @@ export function includeFile(pathFile) { * and annotates that specification is parsed. */ export function stringifySpec(asyncapi) { - return JSON.stringify(asyncapi.json()); + return stringify(asyncapi); } /** diff --git a/test/components/__snapshots__/index.test.js.snap b/test/components/__snapshots__/index.test.js.snap index 17c43ac02..0f133aefd 100644 --- a/test/components/__snapshots__/index.test.js.snap +++ b/test/components/__snapshots__/index.test.js.snap @@ -104,434 +104,7 @@ exports[`Index component should render AsyncAPI v2 document 1`] = ` @@ -553,8 +126,8 @@ exports[`Index component should render AsyncAPI v3 document 1`] = ` -

Adeo AsyncAPI Case Study %REPLACED_BY_MAVEN%

  • Introduction
  • Servers
  • Operations
    • SUB[COSTING] Request one or more Costing calculation for any product -
    • PUB[COSTING] Get the costing responses matching an initial Costing Request. +
      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:
        • API key

          Use SASL authentication with SSL encryption to connect to the ADEO Broker.

          @@ -562,47 +135,7 @@ exports[`Index component should render AsyncAPI v3 document 1`] = `
          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.

        +
        security.protocol:SASL_SSL
        sasl.mechanism:PLAIN
      object
      schemaRegistryUrl
      https://schema-registry.dev.url/

Operations

Messages