Расположение документации Swagger не существует - PullRequest
1 голос
/ 11 апреля 2020

Я пытался развернуть мои конечные точки облака Google, однако я получаю сообщение об ошибке "местоположение не существует"? Кажется, я не могу понять, что не так с моим файлом yaml, я строю на примере документации

Мне кажется, что я не получаю заданные c сообщения об ошибках из облачной консоли Google, делает ли мой файл yaml хорошо выглядишь? извините, если это кажется сомнительным, это очень ново для меня

open-api-appengine.yaml

# [START swagger]
swagger: "2.0"
info:
  description: "" API Endpoint"
  title: "API Endpoint"
  version: "1.0.0"
host: "EXAMPLE"
# [END swagger]
consumes:
- "application/json"
produces:
- "application/json"
schemes:
- "https"
paths:
#/getallyield path
  "/getallyield":
    get:
      description: "return all arrays under yield"
      operationId: "allyield"
      produces:
      - "application/json"
      responses:
        200:
          description: "return all arrays under yield"
          schema:
            $ref: "#/definitions/allyield"
      security:
      - api_key: []
#/getyield{id} path
  "/gettotalyield/{date}":
    get:
      description: "Returns the requests' authentication information."
      operationId: "auth_info_google_jwt"
      parameters:
        - name: date
          in: path
          description: "date of total yield"
          required: true
          schema:
            type: string
            format: date
      produces:
      - "application/json"
      responses:
        200:
          description: "Authentication info."
          schema:
            $ref: "#/definitions/authInfoResponse"
      security:
      - api_key: []
  "/getyield/{id}":
    get:
      description: "Returns the requests' authentication information."
      operationId: "authInfoGoogleIdToken"
      parameters:
        - name: id
          in: path
          description: "id of requested document"
          required: true
          schema:
            type: integer
            format: int64
      produces:
      - "application/json"
      responses:
        200:
          description: "Authentication info."
          schema:
            $ref: "#/definitions/authInfoResponse"
      security:
      - api_key: []
  "/login":
    get:
      description: "Returns the requests' authentication information."
      operationId: "authInfoFirebase"
      produces:
      - "application/json"
      responses:
        200:
          description: "Authentication info."
          schema:
            $ref: "#/definitions/authInfoResponse"
      security:
      - api_key: []
########################################################################################################################################################################
definitions:
  echoMessage:
    type: "object"
    properties:
      message:
        type: "string"
  authInfoResponse:
    properties:
      id:
        type: "string"
      email:
        type: "string"
# [START securityDef]
securityDefinitions:
  # This section configures basic authentication with an API key.
  api_key:
    type: "apiKey"
    name: "key"
    in: "query"
# [END securityDef]
  # This section configures authentication using Google API Service Accounts
  # to sign a json web token. This is mostly used for server-to-server
  # communication.
  google_jwt:
    authorizationUrl: ""
    flow: "implicit"
    type: "oauth2"
    # This must match the 'iss' field in the JWT.
    x-google-issuer: "jwt-client.endpoints.sample.google.com"
    # Update this with your service account's email address.
    x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/jwk/YOUR-SERVICE-ACCOUNT-EMAIL"
    # This must match the "aud" field in the JWT. You can add multiple audiences to accept JWTs from multiple clients.
    x-google-audiences: "echo.endpoints.sample.google.com"
  # This section configures authentication using Google App Engine default
  # service account to sign a json web token. This is mostly used for
  # server-to-server communication.
  gae_default_service_account:
    authorizationUrl: ""
    flow: "implicit"
    type: "oauth2"
    # Replace YOUR-CLIENT-PROJECT-ID with your client project ID.
    x-google-issuer: "YOUR-CLIENT-PROJECT-ID@appspot.gserviceaccount.com"
    # Replace YOUR-CLIENT-PROJECT-ID with your client project ID.
    x-google-jwks_uri: "https://www.googleapis.com/robot/v1/metadata/x509/YOUR-CLIENT-PROJECT-ID@appspot.gserviceaccount.com"
    # This must match the "aud" field in the JWT. You can add multiple audiences to accept JWTs from multiple clients.
    x-google-audiences: "echo.endpoints.sample.google.com"
  # This section configures authentication using a service account
  # to sign a json web token. This is mostly used for server-to-server
  # communication.
  google_service_account:
    authorizationUrl: ""
    flow: "implicit"
    type: "oauth2"
    # Replace YOUR-SERVICE-ACCOUNT-EMAIL with your service account email.
    x-google-issuer: "YOUR-SERVICE-ACCOUNT-EMAIL"
    # Replace YOUR-SERVICE-ACCOUNT-EMAIL with your service account email.
    x-google-jwks_uri: "https://www.googleapis.com/robot/v1/metadata/x509/YOUR-SERVICE-ACCOUNT-EMAIL"
    # This must match the "aud" field in the JWT. You can add multiple audiences to accept JWTs from multiple clients.
    x-google-audiences: "echo.endpoints.sample.google.com"
  # This section configures authentication using Google OAuth2 ID Tokens.
  # ID Tokens can be obtained using OAuth2 clients, and can be used to access
  # your API on behalf of a particular user.
  google_id_token:
    authorizationUrl: ""
    flow: "implicit"
    type: "oauth2"
    x-google-issuer: "https://accounts.google.com"
    x-google-jwks_uri: "https://www.googleapis.com/oauth2/v3/certs"
    # Your OAuth2 client's Client ID must be added here. You can add multiple client IDs to accept tokens form multiple clients.
    x-google-audiences: "YOUR-CLIENT-ID"
  # This section configures authentication using Firebase Auth.
  # [START firebaseAuth]
  firebase:
    authorizationUrl: ""
    flow: "implicit"
    type: "oauth2"
    x-google-issuer: "https://securetoken.google.com/YOUR-PROJECT-ID"
    x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com"
    x-google-audiences: "YOUR-PROJECT-ID"
  # [END firebaseAuth]

Это ошибка, которую я получаю с консоли GCP

ERROR: (gcloud.endpoints.services.deploy) INVALID_ARGUMENT: Cannot convert to service config.
'location: "unknown location"
kind: ERROR
message: "Invalid OpenAPI file. Please fix the schema errors:\nerror: instance failed to match exactly one schema (matched 0 out of 2)\n    level: \"error\"\n    schema: {\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/parametersList/items\"}\n    instance: {\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"}\n    domain: \"validation\"\n    keyword: \"oneOf\"\n    matched: 0\n    nrSchemas: 2\n    reports: {\"/definitions/parametersList/items/oneOf/0\":[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/parameter\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"oneOf\",\"message\":\"instance failed to match exactly one schema (matched 0 out of 2)\",\"matched\":0,\"nrSchemas\":2,\"reports\":{\"/definitions/parameter/oneOf/0\":[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/bodyParameter/properties/in\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0/in\"},\"domain\":\"validation\",\"keyword\":\"enum\",\"message\":\"instance value (\\\"path\\\") not found in enum (possible values: [\\\"body\\\"])\",\"value\":\"path\",\"enum\":[\"body\"]}],\"/definitions/parameter/oneOf/1\":[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/nonBodyParameter\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"oneOf\",\"message\":\"instance failed to match exactly one schema (matched 0 out of 4)\",\"matched\":0,\"nrSchemas\":4,\"reports\":{\"/definitions/nonBodyParameter/oneOf/0\":[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/headerParameterSubSchema\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"additionalProperties\",\"message\":\"object instance has properties which are not allowed by the schema: [\\\"schema\\\"]\",\"unwanted\":[\"schema\"]}],\"/definitions/nonBodyParameter/oneOf/1\":[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/formDataParameterSubSchema\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"additionalProperties\",\"message\":\"object instance has properties which are not allowed by the schema: [\\\"schema\\\"]\",\"unwanted\":[\"schema\"]}],\"/definitions/nonBodyParameter/oneOf/2\":[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/queryParameterSubSchema\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"additionalProperties\",\"message\":\"object instance has properties which are not allowed by the schema: [\\\"schema\\\"]\",\"unwanted\":[\"schema\"]}],\"/definitions/nonBodyParameter/oneOf/3\":[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/pathParameterSubSchema\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"additionalProperties\",\"message\":\"object instance has properties which are not allowed by the schema: [\\\"schema\\\"]\",\"unwanted\":[\"schema\"]}]}},{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/nonBodyParameter\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"required\",\"message\":\"object has missing required properties ([\\\"type\\\"])\",\"required\":[\"in\",\"name\",\"type\"],\"missing\":[\"type\"]}]}}],\"/definitions/parametersList/items/oneOf/1\":[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/jsonReference\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"additionalProperties\",\"message\":\"object instance has properties which are not allowed by the schema: [\\\"description\\\",\\\"in\\\",\\\"name\\\",\\\"required\\\",\\\"schema\\\"]\",\"unwanted\":[\"description\",\"in\",\"name\",\"required\",\"schema\"]},{\"level\":\"error\",\"schema\":{\"loadingURI\":\"http://swagger.io/v2/schema.json#\",\"pointer\":\"/definitions/jsonReference\"},\"instance\":{\"pointer\":\"/paths/~1gettotalyield~1{date}/get/parameters/0\"},\"domain\":\"validation\",\"keyword\":\"required\",\"message\":\"object has missing required properties ([\\\"$ref\\\"])\",\"required\":[\"$ref\"],\"missing\":[\"$ref\"]}]}"

Я запустил свой yaml на swagger editor.io, и, похоже, нет ошибок формата, я не могу понять, что я сделал неправильно? также извинения за то, как средство форматирования кода обработало сообщение об ошибке

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...