Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML Support #159

Open
v3ss0n opened this issue Dec 20, 2020 · 5 comments
Open

YAML Support #159

v3ss0n opened this issue Dec 20, 2020 · 5 comments

Comments

@v3ss0n
Copy link

v3ss0n commented Dec 20, 2020

Configuring with json is hard when it grows bigger.
Can we have YAML support? Converting YAML to JSON would be fine for start.

@v3ss0n
Copy link
Author

v3ss0n commented Dec 20, 2020

it will look like this:

---
name: RESTool App
favicon: https://www.commoninja.com/public/favicon.ico
baseUrl: https://restool-sample-app.herokuapp.com/api
pages:
- name: Cast & Characters
  id: characters
  description: Manage GOT characters location and budget.
  methods:
    getAll:
      label: Get All
      dataPath: items
      url: "/character"
      queryParams:
      - name: search
        value: ''
        label: Search
        type: text
      display:
        type: cards
      fields:
      - name: thumbnail
        type: image
        label: Thumbnail
      - name: id
        type: text
        label: ID
      - name: name
        type: text
        label: Name
      - name: realName
        type: text
        label: Real Name
      - name: location
        type: text
        label: Current Location
      - name: isAlive
        type: boolean
        label: Alive?
    getSingle:
      url: "/character/:id"
      queryParams: []
      requestHeaders: {}
    put:
      url: "/character/:id"
      fields:
      - name: numberTest
        label: Number Test
        type: number
      - name: location
        label: Location
        type: select
        options:
        - Kings Landing
        - Beyond the Wall
        - Winterfell
      - name: isAlive
        label: Alive?
        type: boolean
    post:
      url: "/character"
      fields:
      - name: thumbnail
        label: Thumbnail
        type: text
      - name: name
        label: Name
        type: text
      - name: realName
        label: Real Name
        type: text
      - name: location
        label: Location
        type: select
        options:
        - Kings Landing
        - Beyond the Wall
        - Winterfell
      - name: isAlive
        label: Alive?
        type: boolean
    delete:
      url: "/character/:id"
  customActions:
  - name: Send Email
    url: "/character/:id/sendEmail"
    actualMethod: post
    icon: envelope
    fields:
    - name: id
      type: text
      label: ID
      readonly: true
    - name: title
      type: text
      label: Email Title
      required: true
    - name: body
      type: text
      label: Email Body
      required: true
  - name: Disable Character
    url: "/character/:id/disable"
    actualMethod: post
    icon: ban
    fields:
    - name: id
      type: text
      label: Contact ID
      readonly: true
- name: Employees
  id: employees
  description: Manage GOT employees, people and employees.
  methods:
    getAll:
      label: Get All
      dataPath: items
      url: "/employee"
      queryParams:
      - name: search
        value: ''
        label: Search
        type: text
      display:
        type: table
      fields:
      - name: id
        type: text
        label: ID
      - name: name
        type: text
        label: Name
      - name: jobTitle
        type: text
        label: Job Title
      - name: isFired
        type: boolean
        label: Fired?
    getSingle:
      url: "/employee/:id"
      queryParams: []
      requestHeaders: {}
    put:
      url: "/employee/:id"
      fields:
      - name: name
        label: Name
        type: text
      - name: jobTitle
        type: select
        label: Job Title
        options:
        - Executive Producer
        - Co-Executive Producer
        - "RESTool creator \U0001F60E"
        - A Knows nothing dude.
      - name: isFired
        type: boolean
        label: Fired?
    post:
      url: "/employee"
      fields:
      - name: name
        label: Name
        type: text
      - name: jobTitle
        type: select
        label: Job Title
        options:
        - Executive Producer
        - Co-Executive Producer
        - "RESTool creator \U0001F60E"
        - A Knows nothing dude.
      - name: isFired
        type: boolean
        label: Fired?
    delete:
      url: "/employee/:id"
- name: Deads
  id: deads
  description: "Manage GOT deads \U0001F635"
  methods:
    getAll:
      label: Get All
      dataPath: items
      url: "/dead"
      queryParams:
      - name: search
        value: ''
        label: Search
        type: text
      display:
        type: table
      fields:
      - name: id
        type: text
        label: ID
      - name: name
        type: text
        label: Name
      - name: reason
        type: text
        label: Death Reason
    getSingle:
      url: "/dead/:id"
      queryParams: []
      requestHeaders: {}
    put:
      url: "/dead/:id"
      fields:
      - name: name
        label: Name
        type: text
      - name: reason
        label: Reason
        type: text
    post:
      url: "/dead"
      fields:
      - name: name
        label: Name
        type: text
      - name: reason
        label: Reason
        type: text
    delete:
      url: "/dead/:id"
- name: Extras
  id: extras
  description: Manage GOT extras location and budget.
  methods:
    getAll:
      label: Get All
      dataPath: items
      url: "/extra"
      queryParams:
      - name: search
        value: ''
        label: Search
        type: text
      display:
        type: table
      fields:
      - name: id
        type: text
        label: ID
      - name: name
        type: text
        label: Name
    getSingle:
      url: "/extra/:id"
      queryParams: []
      requestHeaders: {}
    put:
      url: "/extra/:id"
      fields:
      - name: name
        label: Name
        type: text
    post:
      url: "/extra"
      fields:
      - name: name
        label: Name
        type: text
    delete:
      url: "/extra/:id"

@dsternlicht
Copy link
Owner

@v3ss0n Cool! Feel free to open a PR to support that :)

@v3ss0n
Copy link
Author

v3ss0n commented Dec 21, 2020

all the good json-yaml comverters are in golang , notsure how it will fit in this.

@dsternlicht
Copy link
Owner

I guess there's a NPM package that converts yaml files to json.

@v3ss0n
Copy link
Author

v3ss0n commented Dec 21, 2020

many are unmaintained , so looking around , found a good one :
https://www.npmjs.com/package/js-yaml
gonna test it
should i do a build time converter or reader internally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants