#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

apiVersion: v1
kind: ConfigMap
metadata:
  name: skywalking-dynamic-config3
  labels:
    app: collector
    release: skywalking
data:
  core.default.endpoint-name-grouping-openapi.productAPI-v2.yaml: |-
    openapi: 3.0.0
    x-sw-service-name: serviceB
    info:
      description: OpenAPI definition for SkyWalking test.
      version: v2
      title: Product API

    tags:
      - name: product
        description: product
      - name: relatedProducts
        description: Related Products

    paths:
      /products:
        get:
          tags:
            - product
          summary: Get all products list
          description: Get all products list.
          operationId: getProducts
          responses:
            "200":
              description: Success
              content:
                application/json:
                  schema:
                    type: array
                    items:
                      $ref: "#/components/schemas/Product"
      /products/{region}/{country}:
        get:
          tags:
            - product
          summary: Get products regional
          description: Get products regional with the given id.
          operationId: getProductRegional
          parameters:
            - name: region
              in: path
              description: Products region
              required: true
              schema:
                type: string
            - name: country
              in: path
              description: Products country
              required: true
              schema:
                type: string
          responses:
            "200":
              description: successful operation
              content:
                application/json:
                  schema:
                    $ref: "#/components/schemas/Product"
            "400":
              description: Invalid parameters supplied
      /products/{id}:
        get:
          tags:
            - product
          summary: Get product details
          description: Get product details with the given id.
          operationId: getProduct
          parameters:
            - name: id
              in: path
              description: Product id
              required: true
              schema:
                type: integer
                format: int64
          responses:
            "200":
              description: successful operation
              content:
                application/json:
                  schema:
                    $ref: "#/components/schemas/ProductDetails"
            "400":
              description: Invalid product id
        post:
          tags:
            - product
          summary: Update product details
          description: Update product details with the given id.
          operationId: updateProduct
          parameters:
            - name: id
              in: path
              description: Product id
              required: true
              schema:
                type: integer
                format: int64
            - name: name
              in: query
              description: Product name
              required: true
              schema:
                type: string
          responses:
            "200":
              description: successful operation
        delete:
          tags:
            - product
          summary: Delete product details
          description: Delete product details with the given id.
          operationId: deleteProduct
          parameters:
            - name: id
              in: path
              description: Product id
              required: true
              schema:
                type: integer
                format: int64
          responses:
            "200":
              description: successful operation
      /products/{id}/relatedProducts:
        get:
          tags:
            - relatedProducts
          summary: Get related products
          description: Get related products with the given product id.
          operationId: getRelatedProducts
          parameters:
            - name: id
              in: path
              description: Product id
              required: true
              schema:
                type: integer
                format: int64
          responses:
            "200":
              description: successful operation
              content:
                application/json:
                  schema:
                    $ref: "#/components/schemas/RelatedProducts"
            "400":
              description: Invalid product id

    components:
      schemas:
        Product:
          type: object
          description: Product id and name
          properties:
            id:
              type: integer
              format: int64
              description: Product id
            name:
              type: string
              description: Product name
          required:
            - id
            - name
        ProductDetails:
          type: object
          description: Product details
          properties:
            id:
              type: integer
              format: int64
              description: Product id
            name:
              type: string
              description: Product name
            description:
              type: string
              description: Product description
          required:
            - id
            - name
        RelatedProducts:
          type: object
          description: Related Products
          properties:
            id:
              type: integer
              format: int32
              description: Product id
            relatedProducts:
              type: array
              description: List of related products
              items:
                $ref: "#/components/schemas/Product"
