Giter Club home page Giter Club logo

Comments (1)

jstoiko avatar jstoiko commented on June 13, 2024

Closing this issue since it works as expected. I.e. Group is translated properly

test.raml:

#%RAML 1.0

title: A CRUD API for Users and Groups
mediaType: application/json

types:

  ###############
  # Common:
  ###############

  Email:
    pattern: "^\\w+(\\.\\w+)[email protected]"

  StaticGroupNums:
    description: Predefined user groups
    enum: [ 12, 26, 30, 31, 32 ]

  DynamicGroupNum:
    description: Dynamically-defined user groups
    pattern: "D\\-\\d+"

  RecordId:
    usage: An id of any record in the system
    type: number

  Record-base:
    usage: Pattern for any record in the system
    properties:
      id:
        type: RecordId
        required: true
      created:
        type: datetime
        required: true

  ###############
  # User:
  ###############

  User-base:
    usage: The base type for user records
    properties:
      firstname:
        required: true
      lastname:
        required: true

  User-new:
    usage: Data for creating a new user
    type: User-base
    properties:
      HRAuth:
        description: Authorization received from HR
        required: true

  User-update:
    usage: Changeable properties of an existing user
    properties:
      firstname:
      lastname:

  User:
    usage: A user in the system
    type: [ User-base, Record-base ]
    properties:
      emails: Email[]

  ###############
  # Group:
  ###############

  Group-base:
    usage: The base type for group records
    properties:
      name:
        required: true

  Group-new:
    usage: Data for creating a new group
    type: Group-base
    properties:
      ITAuth:
        description: Authorization received from IT
        required: true

  Group-update:
    usage: Changeable properties of an existing group
    properties:
      name:

  Group:
    usage: A group in the system
    type: [ Group-base, Record-base ]
    properties:
      groupnum:
        type: StaticGroupNums | DynamicGroupNum
        required: true
$ dt2js ./test.raml Group
{
  "usage": "A group in the system",
  "properties": {
    "id": {
      "usage": "An id of any record in the system",
      "type": "number"
    },
    "created": {
      "type": "string",
      "pattern": "^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2})(:)(\\d{2})(:)(\\d{2})(\\.\\d+)?(Z|([+-])(\\d{2})(:)?(\\d{2}))$"
    },
    "name": {
      "type": "any"
    },
    "groupnum": {
      "type": "object",
      "anyOf": [
        {
          "description": "Predefined user groups",
          "enum": [
            12,
            26,
            30,
            31,
            32
          ],
          "type": "any"
        },
        {
          "description": "Dynamically-defined user groups",
          "pattern": "D\\-\\d+",
          "type": "any"
        }
      ]
    }
  },
  "type": "object",
  "additionalProperties": true,
  "required": [
    "id",
    "created",
    "name",
    "groupnum"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}

from ramldt2jsonschema.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.