1
resposta

Procurei seguir as instruções da aula passo a passo e até baixei e comparei mas continuo com erros sendo apresentados: total = 5 errors , 1 Structural e 4 Semantic . Onde foi que errei?

swagger: '2.0'


schemes: 
  - http
  - https

host: localhost:8085
basePath: /bytebank-api/v1

info:
  version: 1.0.0
  title: ByteBank Api
  description: Administra a movimentação bancária do correntista e controla o acesso através de CPF e senha
  termsOfService: http://localhost:8085/bytebank-api/v1/termo-uso
  contact:
    name: Suporte
    url: http://localhost:8085/bytebank-api/v1/suporte
    email: suporte@bytebankapi.com


securityDefinitions:
  BasicAuth:
    type: basic

security: 
  - BasicAuth: []

consumes:
 - application/json
produces:
 - application/json


paths:
  '/cliente':
    post:
      summary: Cadastra Clliente
      description: Cadastra um novo cliente
      operationId: cadastraCliente
      parameters:
        - in: body
          name: cliente_
          schema: 
            $ref: '#/definitions/Cliente'


      responses:
        201:
          description: Cadastro efetuado com sucesso
          schema:
            $ref: '#/definitions/Cliente'
        400:
          description: Requisição inválida
        500:
          description: Erro interno no servidor


  '/conta/{agencia}/{numero}/{digito}/saldo':
    get:
      summary: Consulta Saldo
      description: Consulta o saldo da conta do cliente
      operationId: consultaSaldo
      security:
       - BasicAuth: []
      parameters: 
       - in: path
         name: agencia
         type: integer
         format: int32
         required: true
       - in: path
         name: numero
         type: integer
         format: int64
         required: true
       - in: path
         name: digito
         type: integer
         format: int32
         required: true
       - in: header
         name: Authorization
         type: string
         required: true
      responses:
        200:
          description: Consulta a saldo realizada com sucesso
          schema:
            type: number
            format: double
        400:
          description: Requisição inválida
        401:
          description: Requisição não autorizada
        500:
          description: Erro no servidor










  definitions:

    Cliente:
      type: object
      properties:
        id: 
          type: integer
          format: int64
          example: 234
        titular:
          type: string
          example: Janete Silva
        cpf:
          type: string
          maxLength: 11
          minLength: 11
          example: 01234567890
        senha:
          type: string
          format: password
          example: senha123
        conta:
          type: array
          items:
            $ref: '#/definitions/Conta'  



    Conta:
      type: object
      properties: 
        agencia:
          type: integer
          format: int32
          example: 975
        numero:
          type: integer
          format: int64
          example: 784563
        digito:
          type: integer
          format: int32
          example: 7
        saldo:
          type: number
          format: double
          example: 101.34
        cliente:
          $ref: '#/definitions/Cliente'


1 resposta

Olá, Otoni! Tudo bem?

O problema são os espaçamentos do seu arquivo, por exemplo:

  definitions:

    Cliente:
      type: object
      properties:
        id: 
          type: integer
          format: int64
          example: 234
        titular:
          type: string
          example: Janete Silva
        cpf:
          type: string
          maxLength: 11
          minLength: 11
          example: 01234567890
        senha:
          type: string
          format: password
          example: senha123
        conta:
          type: array
          items:
            $ref: '#/definitions/Conta'  



    Conta:
      type: object
      properties: 
        agencia:
          type: integer
          format: int32
          example: 975
        numero:
          type: integer
          format: int64
          example: 784563
        digito:
          type: integer
          format: int32
          example: 7
        saldo:
          type: number
          format: double
          example: 101.34
        cliente:
          $ref: '#/definitions/Cliente'

deixe como:

definitions:

  Cliente:
    type: object
    properties:
      id: 
        type: integer
        format: int64
        example: 234
      titular:
        type: string
        example: Janete Silva
      cpf:
        type: string
        maxLength: 11
        minLength: 11
        example: 01234567890
      senha:
        type: string
        format: password
        example: senha123
      conta:
        type: array
        items:
          $ref: '#/definitions/Conta'  

  Conta:
    type: object
    properties: 
      agencia:
        type: integer
        format: int32
        example: 975
      numero:
        type: integer
        format: int64
        example: 784563
      digito:
        type: integer
        format: int32
        example: 7
      saldo:
        type: number
        format: double
        example: 101.34
      cliente:
        $ref: '#/definitions/Cliente'

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software