Quantcast
Channel: DreamFactory Forum - Latest posts
Viewing all articles
Browse latest Browse all 5027

Are components definable in custom script services?

$
0
0

Any update on that topic?

Since I couldn’t find much information about it in the wiki, I have tried formatting a service definition by mimicking what I have found in the “native” Dreamfactory Services.

Here is an excerpt of the service definition for the service I created. This service accesses the database tables of a MySQL Service. In the example below, the service, when accessed through /api/v2/test-service/content would query the MySQL table and simply pass on the response.

I have tried adding descriptions for responses, and an operationId for each path. Yet it does not help making Dreamfactory see these paths as components, like for “native” services (see for example the user service at the bottom of this post).

Help or links to documentation would be appreciated :slight_smile:

swagger: '2.0'
basePath: "/api/v2"
info:
  version: "2.0"
  title: "Test Service"
consumes:
  - "application/json"
produces:
  - "application/json"
paths:
  /test-service/content:
    get:
      tags:
      - test-service
      operationId: "getContents"
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/RecordsResponse'
        default:
          description: Error
          schema:
            $ref: '#/definitions/Error'
  /test-service/author:
    get:
      tags:
      - test-service
      operationId: "getAuthors"
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/RecordsResponse'
        default:
          description: Error
          schema:
            $ref: '#/definitions/Error'
...
definitions:
  Success:
    type: object
    properties:
      success:
        type: boolean
        description: "True when API call was successful, false or error otherwise."
  Error:
    type: object
    properties:
      code:
        type: integer
        format: int32
        description: "Error code."
      message:
        type: string
        description: "String description of the error."
  RecordResponse:
    type: object
    properties:
      id:
        type: integer
        format: int32
        description: "Sample identifier of this record."
  RecordsResponse:
    type: object
    properties:
      resource:
        type: array
        description: "Array of system user records."
        items:
          "$ref": "#/definitions/RecordResponse"
tags:
  name: test-service
  description: "A test service"



Viewing all articles
Browse latest Browse all 5027

Trending Articles