Forum Discussion

nishant4121988's avatar
nishant4121988
Occasional Contributor
4 years ago
Solved

Structural error at paths

 

basePath : "/services/apexrest/sg"
schemes:
- "https"
- "http"
paths:
  /0.1/customer:
    get:
      description: Should give an overview / a list of all customers with state active. List should contain ID and Name of customer.
      responses:
        200:
         description: Successfull
         schema:
               type: array
               items:
                properties:
                  id:
                   type: integer
                   example: 007
                  name:
                   type: string
                   example: Nishant
                  count:
                   type: integer
                   example: 04121988
      security:
      - subscription_auth:
        - "write:pets"
        - "read:pets"
        
  /0.1/customer/{account_id}:
    get:
      summary: Get a user by ID
      parameters:
        - in: path
          name: account_id
          type: integer
          required: true
          description: Numeric ID of the Account to get Account Details
      responses:
        200:
          description: Account Details
          schema:
                type: object
                properties:
                  name:
                   type: string
                   example: Nishant
                  site:
                   type: string
                   example: berlin
                  billingAddress:
                   type: string
                   example: berlin
                  description:
                   type: string
                   example: Account's details
                  phone:
                   type: integer
                   example: 02736464648494
                  shippingAddress:
                   type: string
                   example: berlin
                  website:
                   type : string
                   example : www.XXXX.com
                  childAccounts:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  createdBy:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  lastModifiedBy:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  parentAccount:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
      security:
      - subscription_auth:
        - "write:pets"
        - "read:pets"
  /0.1/customer/{account_id}/subscriptions:
    get:
      summary: Get a user's Subscription by ID
      parameters:
        - in: path
          name: account_id
          type: integer
          required: true
          description: Numeric ID of the Account to get
      responses:
        200:
          description: Account Details
          schema:
                type: object
                properties:
                  activeSubscriptions:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  countActiveSubscriptions:
                   type: integer
                  inActiveSubscriptions:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  countInActiveSubscriptions:
                   type: integer
                  canceledSubscriptions:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  countCanceledSubscriptions:
                   type: integer
                   example: 20000
      security:
      - subscription_auth:
        - "write:pets"
        - "read:pets"
  /0.1/subscription:
    get:
      description: Should give an overview / a list of all subscriptions with state active.
      responses:
        200:
         description: Successfull
         schema:
               type: array
               items:
                properties:
                  activeSubscriptions:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  countActiveSubscriptions:
                   type: integer
                   example: 04121988
      security:
      - subscription_auth:
        - "write:pets"
        - "read:pets"
  /0.1/subscription/{SUBSCRIPTION_ID}/:
    get:
      summary: Get a user's Subscription by ID
      parameters:
        - in: path
          name: SUBSCRIPTION_ID
          type: integer
          required: true
          description: Numeric ID of the Subscription to get
      responses:
        200:
          description: Subscription Details
          schema:
                type: object
                properties:
                  id:
                   type: string
                   example: 564664564Nishant
                  name:
                   type: string
                   example: Nishant
                  account:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  createdBy:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  currency:
                   type: integer
                   example: 02736464648494
                  initialMRR:
                   type: integer
                  lastInvoiceRun:
                   type : string
                  owner:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  nextInvoice:
                   type: string
                  lastModifiedBy:
                   type: object
                   items:
                     properties:
                       Id :
                        type : string
                       name :
                        type : string
                  quoteNumber:
                   type: string
                  renewalDate:
                   type: string
                  startDate:
                   type: string
                  status:
                   type: string
      security:
      - subscription_auth:
        - "write:pets"
        - "read:pets"
  /0.2/jobs/{JOB_ID}/:
    get:
      summary: Get a user's Service by Job_ID
      parameters:
        - in: path
          name: JOB_ID
          type: integer
          required: true
          description: Numeric ID of the Job to get details from the Service object
      responses:
        200:
          description: Job Details
          schema:
                type: object
                properties:
                  name:
                   type: string
                   example: Nishant
                  Price:
                   type: integer
                   example: 02736464648494
                  Channel:
                   type : string
                  Date:
                   type: string
      security:
      - subscription_auth:
        - "write:pets"
        - "read:pets"
                  
  securitySchemes:
    oAuth2ClientCredentials:
      type: oauth2
      description: /services/oauth2/success
      flows: 
        clientCredentials: 
          tokenUrl: /oauth2/token
          scopes: 
            write: modify your account
            read: read your Account
securityDefinitions:
  subscription_auth:
    type: "oauth2"
    authorizationUrl: "http://--uat.lightning.force.com/oauth/dialog"
    flow: "implicit"
    scopes:
      write:pets: "modify subscription"
      read:pets: "read your record"
  api_key:
    type: "apiKey"
    name: "api_key"
    in: "header"

 

  • HKosova's avatar
    HKosova
    4 years ago

    OK I see the error now. It's caused by an extra "securitySchemes" section in "paths". You need to remove it.

     

7 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Can you please format your YAML as code to preserve the original indentation? Otherwise it's hard to see where the error might be.

     

    • nishant4121988's avatar
      nishant4121988
      Occasional Contributor

      Thanks for getting back. i edited it for your kind reference.

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        If don't see any errors about paths, only errors about missing securityDefinitions.

         

         

        Is it possible that your original API definition uses a mix of tabs and spaces for indentation? This can cause strange errors like the one you're seeing. Try to indent everything using spaces and see if it helps.