Open API 3.0 Swagger Hub

Asked

Viewed 120 times

0

Good afternoon, I’m experiencing 2 Query strings in paths are not allowed errors in Swagger. Does anyone know any way to solve ?

openapi: 3.0.0
servers:
  - url: https://armariosinteligentes.com/api/v2
    description: API server V2
info:
  version: "0.0.3"
  title: 'Armário Conectado'
  description: 'API web do armário conectado'
  contact:
    email: '[email protected]'
  license:
    name: teste
    url: 'http://www.google/teste'
security: 
  - application:
    - read
    - write
tags:
  - name: GET
    description: 'Informações do armário da recepção'
  - name: POST
    description: 'Teste de abrir as portas.'  
paths:
  /dispositivo/{device_id}/{endereco}?client_id={client_id}&timestamp={timestamp}&signature={assinatura}:
      parameters:
        - name: device_id
          in: path
          required: true
          description: Identificação do dispositivo
          #0J2BEEBB5607417216L8253E650CAT08
          schema:
            type: string
        - name: endereco
          in: path
          required: true
          description: endereço do metodo
          #id,info,nome,versao,ip,mac,rssi,wifi,numeracaoinicial
          #tipodispositivo,tamanhoscompartimentos,compartimentos
          #modulos,portasabertas
          schema:
            type: string
        - name: client_id
          in: path
          required: true
          description: Id de identificação do cliente
          #756b5f017f83124641805n1c81k4bd89
          schema:
            type: string
        - name: timestamp
          in: path
          required: true
          description: Tempo formato Unix epoch
          #timestamp=1533081600
          schema:
            type: integer
        - name: assinatura
          in: path
          required: true
          description: Gerar a Assinatura HMAC SHA256 com a Query String
          schema:
            type: string
      get:
        tags:
        - GET
        responses:
          200:
            description: Ok
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/body_response'
          401:
            description: Assinatura invalida, inexistente ou expirado
          404:
            description: Recurso não encontrado
          500:
            description: Erro no servidor

  /dispositivo/{device_id}/{endereco}?{parametro1}={parametro2}&client_id={client_id}&timestamp={timestamp}&signature={assinatura}:
      parameters:
      - name: device_id
        in: path
        required: true
        description: Identificação do dispositivo
        #0J2BEEBB5607417216L8253E650CAT08
        schema:
          type: string
      - name: endereco
        in: path
        required: true
        description: Endereço do metodo
        #abrirporta,situacaoporta,abrirtodasasportas,
        #alterarnumeracaoinicial,reiniciar,alteraripspermitido
        #padraodefabrica,reconfigurar,atualizar
        schema:
          type: string
      - name: parametro1
        in: path
        required: true
        description: Parametro 1 do metodo
        #numero
        schema:
          type: string
      - name: parametro2
        in: path
        required: true
        description: Parametro 2 do metodo
        #1
        schema:
          type: string
      - name: client_id
        in: path
        required: true
        description: Identificação do cliente
        #756b5f017f83124641805n1c81k4bd89
        schema:
          type: string
      - name: timestamp
        in: path
        required: true
        description: Tempo formato Unix epoch
        #timestamp=1533081600
        schema:
          type: integer
      - name: assinatura
        in: path
        required: true
        description: Gerar a Assinatura HMAC SHA256 com a Query String
        schema:
          type: string
      post:
        tags:
          - POST
        responses:
          200:
            description: Ok
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/body_response2'
          401:
            description: Assinatura invalida, inexistente ou expirado
          404:
            description: Recurso não encontrado
          500:
            description: Erro no servidor

components:
  schemas:
    body_response:
      type: object
      required:
        - nome
        - id
        - mac
        - ip
        - sdk
        - versao
        - modoConexao
      properties:
        nome:
          type: string
          example: ARMARIO_000073
        id:
          type: string
          example: 5C756F116263J1E971B3C4E18
        sdk:
          type: string
          example: v3.3-beta1-179-ge931fe9f5
        versao:
          type: string
          example: 0.9.4
        modoConexao:
          type: string
          example: MQTT
        mac:
          type: string
          example: 25:CD:B7:21:S5:A2
        ip:
          type: string
          example: 192.52.69.78
    body_response2:
      type: object
      required:
        - reconfigurar
      properties:
        reconfigurar:
          type: string
          example: Reconfigurado com sucesso `

24 -Query strings in paths are not allowed. 79-Query strings in paths are not allowed.

1 answer

0

I got

openapi: 3.0.0
servers:
  - url: https://armariosinteligentes.com/api/v2
    description: API server V2
info:
  version: "0.0.3"
  title: 'Armário Conectado'
  description: 'API web do armário conectado'
  contact:
    email: '[email protected]'
  license:
    name: Biccateca
    url: 'http://wwww.google.com'
security: 
  - application:
    - read
    - write
tags:
  - name: GET
    description: 'Informações do armário da recepção'
  - name: POST
    description: 'Teste de abrir as portas.'  
paths:
  /dispositivo/{device_id}/{endereco}:
    get:
      tags:
      - GET
      parameters:
        - name: device_id
          in: path
          required: true
          description: Identificação do dispositivo
          #0J2BEEBB5607417216L8253E650CAT08
          schema:
            type: string
        - name: endereco
          in: path
          required: true
          description: endereço do metodo
          #id,info,nome,versao,ip,mac,rssi,wifi,numeracaoinicial
          #tipodispositivo,tamanhoscompartimentos,compartimentos
          #modulos,portasabertas
          schema:
            type: string
        - name: client_id
          in: query
          required: true
          description: Id de identificação do cliente
          #756b5f017f83124641805n1c81k4bd89
          schema:
            type: string
        - name: timestamp
          in: query
          required: true
          description: Tempo formato Unix epoch
          #timestamp=1533081600
          schema:
            type: integer
        - name: signature
          in: query
          required: true
          description: Gerar a Assinatura HMAC SHA256 com a Query String
          schema:
            type: string
      responses:
        200:
          description: teste
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/body_response'
        401:
          description: Assinatura invalida, inexistente ou expirado
        404:
          description: Recurso não encontrado
        500:
          description: Erro no servidor
    post:
      tags:
        - POST
      parameters:
        - name: device_id
          in: path
          required: true
          description: Identificação do dispositivo
          #0J2BEEBB5607417216L8253E650CAT08
          schema:
            type: string
        - name: endereco
          in: path
          required: true
          description: Endereço do metodo
          #abrirporta,situacaoporta,abrirtodasasportas,
          #alterarnumeracaoinicial,reiniciar,alteraripspermitido
          #padraodefabrica,reconfigurar,atualizar
          schema:
            type: string
        - name: numero
          in: query
          required: true
          description: Parametro 1 do metodo
          schema:
            type: string
        - name: client_id
          in: query
          required: true
          description: Identificação do cliente
          #756b5f017f83124641805n1c81k4bd89
          schema:
            type: string
        - name: timestamp
          in: query
          required: true
          description: Tempo formato Unix epoch
          #timestamp=1533081600
          schema:
            type: integer
        - name: signature
          in: query
          required: true
          description: Gerar a Assinatura HMAC SHA256 com a Query String
          schema:
            type: string
      responses:
        200:
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/body_response2'
        401:
          description: Assinatura invalida, inexistente ou expirado
        404:
          description: Recurso não encontrado
        500:
          description: Erro no servidor
components:
  schemas:
    body_response:
      type: object
      required:
        - nome
        - id
        - mac
        - ip
        - sdk
        - versao
        - modoConexao
      properties:
        nome:
          type: string
          example: ARMARIO_000073
        id:
          type: string
          example: 5C756F116263J1E971B3C4E18
        sdk:
          type: string
          example: v3.3-beta1-179-ge931fe9f5
        versao:
          type: string
          example: 0.9.4
        modoConexao:
          type: string
          example: MQTT
        mac:
          type: string
          example: 25:CD:B7:21:S5:A2
        ip:
          type: string
          example: 192.52.69.78
    body_response2:
      type: object
      required:
        - reconfigurar
      properties:
        reconfigurar:
          type: string
          example: Reconfigurado com sucesso

Browser other questions tagged

You are not signed in. Login or sign up in order to post.