# 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.
#
#
# Add some `Specification Extensions` for SkyWalking config in the OpenAPI definition documents, otherwise, all configs are default:
#   `${METHOD}` is a reserved placeholder which represents the HTTP method eg. `POST/GET...`
#   `${PATH}` is a reserved placeholder which represents the path eg. `/products/{id}`.
#
#   | Extension Name | Required | Description | Default Value |
#   |-----|-----|-----|-----|
#   | x-sw-service-name | false | The service name to which these endpoints belong | The directory name which the definition documents belong to|
#   | x-sw-endpoint-name-match-rule | false | The rule used to match the endpoint.| `${METHOD}:${PATH}` |
#   | x-sw-endpoint-name-format | false | The endpoint name after grouping.| `${METHOD}:${PATH}` |
#
#   These extensions are under `OpenAPI Object`. For example, the document below has a full custom config:
#
#``` yaml
#openapi: 3.0.0
#x-sw-service-name: serviceB
#x-sw-endpoint-name-match-rule: "<${METHOD}>:${PATH}"
#x-sw-endpoint-name-format: "<${METHOD}>:${PATH}"
#
#info:
#  description: OpenAPI definition for SkyWalking test.
#  version: v2
#  title: Product API
#  ...
#```
#
#   We highly recommend using the default config, the custom config (`x-sw-endpoint-name-match-rule/x-sw-endpoint-name-format`) would be considered as part of the match rules (regex pattern).
#   We provide some cases in `org.apache.skywalking.oap.server.core.config.group.openapi.EndpointGroupingRuleReader4OpenapiTest`, you could validate your custom config as well.


###################################################
# This is only a example using the default config.#
###################################################


#openapi: 3.0.0
#
#info:
#  description: OpenAPI definition for SkyWalking test.
#  version: v1
#  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/{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"