Skip to content

Property object generation  #68

@aygalinc

Description

@aygalinc

I have the following schema :

CommonNetworkType:
      description: All the network types available
      type: string
      enum:
        - electrical
        - modbus-sl
    CommonNetwork:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/DefaultId'
        type:
          $ref: '#/components/schemas/CommonNetworkType'
        name:
          type: string
          description: The name of the network
          example: "My beautiful network name"
        isEnabled:
          type: boolean
          example: true
        numberOfNodes:
          type: integer
          description: "Specify the number of nodes that this network has"
          example: 12
        healthState:
          $ref: '#/components/schemas/HealthState'
CommunicationNetwork:
      oneOf:
        - $ref: '#/components/schemas/ZigbeeCommunicationNetwork'
        - $ref: '#/components/schemas/ModbusSLCommunicationNetwork'
      discriminator:
        propertyName: type
 ModbusSLCommunicationNetwork:
      allOf:
        - $ref: '#/components/schemas/CommonNetwork'
        - type: object
          properties:
            type:
              example: "modbus-sl"
            properties:
              type: object
              properties:
                baudRate:
                  type: integer
                  enum: [1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200]
                parity:
                  type: string
                  enum: ["none", "odd", "even"]
                numberOfStopBits:
                  type: string
                  enum: ["0", "1", "2"]
                frameDelay:
                  type: integer
                  example: 20
                silentinterval:
                  type: integer
                  example: 30

The ModbusSLCommunicationNetwork generation is :

public class ModbusSLCommunicationNetwork {
  private String id;
  private Object type;
  private String name;
  private Boolean isEnabled;
  private Integer numberOfNodes;
  private String healthState;
  private JsonObject properties;
....

I have hope that the properties filed will be more typed than a JsonObject.

Regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions