foss42 / apidash

API Dash is a beautiful open-source cross-platform API Client built using Flutter which can help you easily create & customize your API requests, visually inspect responses and generate API integration code. A lightweight alternative to postman/insomnia.
https://apidash.dev
Apache License 2.0
1.43k stars 269 forks source link

Validate CodeGen for Julia (HTTP) #369

Closed AcousticDeveloper closed 5 months ago

AcousticDeveloper commented 5 months ago

PR Description

This PR adds multipart form support for Julia HTTP, adds testing for POST 4 to POST 9 and fixes various bugs. Bugs fixed in this PR are -

  1. Previously the generated code wasn't properly indented, especially JuliaFormatter formats the generated payload and header Dict.
  2. Parsing JSON into Dict was throwing error while running the generated code as null was being considered as an undefined variable. In this PR, JSON is kept as string.
  3. Previously, multipart requests were created manually using a user defined function, which added boilerplate. HTTP.jl natively supports Multipart requests using HTTP.Form, which is added in this PR.
  4. Earlier JSON package was added to handle JSON parsing. As we are not converting Dict to JSON, thus we do not need to import the package anymore.

Related Issues

Checklist

Added/updated tests?

Local Setup for Testing

  1. Install Julia following the instructions in the Documentation.
  2. Inside terminal, open Julia REPL using julia command.
  3. Use ] to get into Package mode, then use add HTTP to install HTTP. Alternatively, directly from inside Julia REPL, run use Pkg and then Pkg.add("HTTP") to install 'HTTP`.
  4. Exit the REPL using exit() command.
  5. Create a file main.jl and paste the generated code inside that file.
  6. Execute the file using julia main.jl from the terminal.
AcousticDeveloper commented 5 months ago

@animator @ashitaprasad Due to merging resolve-issue-147 and main in my local system, the commits for Ruby Faraday Code Generator was also mistakenly shown in this pull request. I have removed the unnecessary files from this pull request and restored my local system too.

If a new pull request with a clean git history is deemed necessary, please do not hesitate to ask. I will be happy to create a new pull request.

animator commented 5 months ago

Thanks for the PR @AcousticDeveloper LGTM 🚀