Julien-cpsn / ATAC

A simple API client (postman like) in your terminal
https://atac.julien-cpsn.com/
MIT License
1.86k stars 81 forks source link

Support the input file format to YAML #30

Closed rabin-io closed 4 months ago

rabin-io commented 5 months ago

Just a suggestion, can you add support for yaml as the input for the collection, yaml is more human friendly, for read and write. You can also have references (anchors) to reduce repetitive blocks.

Just a thought :)

Julien-cpsn commented 5 months ago

Hello!

I personnally really do not like (hate) Yaml files. In contexts where you can have tabulated or big text it's by far one of the most unpractical things (e.g. request body).

I am not closed to the idea though

Have a great day

rabin-io commented 5 months ago

YAML and JSON are pretty much interchangeable, but YAML do have some benefits over JSON when it comes to human-readable (and editing).

Take the file auth.json for example, it can be written almost half of the length. Which I find much easier to skim with the eyes, without all the extra fluff of JSON with quotes and curly braces.

---
name: Auth
requests:
- name: Test Basic Auth
  url: https://httpbin.org/basic-auth/username/pwd
  method: GET
  params: []
  headers: &default_headers
  - enabled: true
    data:
    - cache-control
    - no-cache
  - enabled: true
    data:
    - user-agent
    - ATAC/v0.7.0
  - enabled: true
    data:
    - accept
    - "*/*"
  - enabled: true
    data:
    - accept-encoding
    - gzip, deflate, br
  - enabled: true
    data:
    - connection
    - keep-alive
  body: no_body
  auth:
    basic_auth:
    - username
    - password
  settings: &default_settings
    use_config_proxy: true
    allow_redirects: true
    store_received_cookies: true
    pretty_print_response_content: true
- name: Test Bearer Auth
  url: https://httpbin.org/bearer
  method: GET
  params: []
  headers:
  <<: *default_headers
  body: no_body
  auth:
    bearer_token: my_bearer=
  settings:
    <<: *default_settings
ccoVeille commented 5 months ago

I second the idea that supporting yaml would be a great thing

Julien-cpsn commented 5 months ago

You are right here https://github.com/Julien-cpsn/ATAC/commit/950ed65b62854c52bb69af7dae4c3161310452dd#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R215 I'll let the issue open in order for people to debate. In case "everyone" agrees, it will probably be implemented. But just to let you know it will probably be very low in the priority list

Julien-cpsn commented 4 months ago

@rabin-io @ccoVeille

Here you go https://github.com/Julien-cpsn/ATAC/releases/tag/v0.15.1

ccoVeille commented 4 months ago

Thanks

rabin-io commented 4 months ago

+1 Thanks