Forum Discussion

bob_786's avatar
bob_786
Occasional Visitor
3 years ago

How can I refer different object in

I am trying to generate Go code using openapi-codegen to generate the Go code. I have four different objects with different fields and based on the endPoint I want to set up the required object in the request body but for some reason my type file is coming as empty. Can someone please tell me where am I making mistake? or how can I refer my link everything together so I don't have to define the same objects for different endPoints? 

 

```

openapi: 3.0.0
info:
  version: '0.0.1'
  title: 'INPUT-FORM-API'
  description: ''

paths:
  /api/v1/test/healthcheck:
    get:
      summary: Health check for the test api services. Used Internally
      operationId: Internalhealthcheck
      description: healthcheck for the test services status.
      response:
        '200':
          description: This status is always returned when service is Ok.
          content:
            application/json:
              shema:
                $ref: '#/components/schemas/healthcheckObject'

  /api/v1/test/newformentry:
    post:
      summary: End Point to insert data into the new table.
      operationId: NewFormEntry
      description: EndPoint to insert data for new form.
      requestBody:
          description: Callback payload
          content:
            'application/json':
              schema:
                $ref: '#/components/schemas/NewFormEntry'
      response:
        '200':
            description: This status is always returned when service is Ok.
            content:
              application/json:
                shema:
                  $ref: '#/components/schemas/healthcheckObject'

components:
  schemas:
    NewFormEntry:
      type: object
      required:
        - UserInformation
        - AddressInformation
        - ContactInformation      

UserInformation:
    type: object
    properties:
    Required:
      - FirstName
      - LastName
    FirstName:
      type: string
    LastName:
      type: string

AddressInformation:
  type: object
  properties:
  Required:
    - StreetAddress
    - City
    - State
    - ZipCode
  StreetAddress:
    type: string
  StreetAddress2:
    type: string
  City:
    type: string
  State:
    type: string  
  ZipCode:
    type: int


ContactInformation:
  type: object
  properties:
  Required:
    - PhoneNumber
    - Email
  PhoneNumber:
    type: int4
    length: 9
  Email:
    type: string
  HomePhone:
    type: int4
    length: 9
  Cell:
    type: int4
    length: 9
  WorkPhone:
    type: int4
    length: 9

MessageFromBene:
  type: object
  properties:
  Required:
    - Message
  PhoneNumber:
    type: int4
    length: 9
  Message:
    type: string
No RepliesBe the first to reply