Skip to content

Commit f8bd66e

Browse files
authored
Merge branch 'main' into resolve-issue-json
2 parents 717c888 + 4da1e67 commit f8bd66e

File tree

66 files changed

+2030
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2030
-530
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
1113
migrate_working_dir/
1214
.fvm
1315
.fvmrc

doc/dev_guide/api_endpoints_for_testing.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,28 @@ A List of API endpoints that can be used for testing API Dash
1515
#### For Testing sites with Bad Certificate
1616
- https://badssl.com/
1717
- https://www.ssl.com/sample-valid-revoked-and-expired-ssl-tls-certificates/
18+
19+
#### PDF
20+
21+
- https://training.github.com/downloads/github-git-cheat-sheet.pdf
22+
23+
#### Text
24+
25+
- https://www.google.com/robots.txt
26+
27+
#### JSON
28+
29+
- https://api.apidash.dev/openapi.json
30+
31+
#### XML
32+
33+
- https://apidash.dev/sitemap.xml
34+
35+
#### Video
36+
37+
- https://download.blender.org/peach/bigbuckbunny_movies/
38+
- https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
39+
40+
#### Audio
41+
42+
-

doc/proposals/2025/gsoc/application_papa_kofi_api_auth.md

Lines changed: 322 additions & 0 deletions
Large diffs are not rendered by default.

doc/proposals/2025/gsoc/idea_Akshay_Waghmare_ai-agent-testing.md

Lines changed: 309 additions & 0 deletions
Large diffs are not rendered by default.
127 KB
Loading
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## Instructions
2+
3+
- Create a fork of API Dash.
4+
- In the folder [doc/proposals/2025/gsoc](https://github.com/foss42/apidash/tree/main/doc/proposals/2025/gsoc) create a file named `application_<your name>_<short project name>.md`
5+
6+
The file should contain the follow:
7+
8+
```
9+
### About
10+
11+
1. Full Name
12+
3. Contact info (email, phone, etc.)
13+
6. Discord handle
14+
7. Home page (if any)
15+
8. Blog (if any)
16+
9. GitHub profile link
17+
10. Twitter, LinkedIn, other socials
18+
11. Time zone
19+
12. Link to a resume (PDF, publicly accessible via link and not behind any login-wall)
20+
21+
### University Info
22+
23+
1. University name
24+
2. Program you are enrolled in (Degree & Major/Minor)
25+
3. Year
26+
5. Expected graduation date
27+
28+
### Motivation & Past Experience
29+
30+
Short answers to the following questions (Add relevant links wherever you can):
31+
1. Have you worked on or contributed to a FOSS project before? Can you attach repo links or relevant PRs?
32+
2. What is your one project/achievement that you are most proud of? Why?
33+
3. What kind of problems or challenges motivate you the most to solve them?
34+
4. Will you be working on GSoC full-time? In case not, what will you be studying or working on while working on the project?
35+
6. Do you mind regularly syncing up with the project mentors?
36+
7. What interests you the most about API Dash?
37+
8. Can you mention some areas where the project can be improved?
38+
39+
### Project Proposal Information
40+
41+
1. Proposal Title
42+
2. Abstract: A brief summary about the problem that you will be tackling & how.
43+
3. Detailed Description
44+
4. Weekly Timeline: A rough week-wise timeline of activities that you would undertake.
45+
46+
```
47+
48+
- Feel free to add images by adding it to the `images` folder inside [doc/proposals/2025/gsoc](https://github.com/foss42/apidash/tree/main/doc/proposals/2025/gsoc) and linking it to your doc.
49+
- Finally, send your application as a PR for review.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Instructions
2+
3+
- Create a fork of API Dash.
4+
- In the folder [doc/proposals/2025/gsoc](https://github.com/foss42/apidash/tree/main/doc/proposals/2025/gsoc) create a file named `idea_<your name>_<short project name>.md`
5+
6+
The file should contain the following:
7+
8+
```
9+
### Initial Idea Submission
10+
11+
Full Name:
12+
University name:
13+
Program you are enrolled in (Degree & Major/Minor):
14+
Year:
15+
Expected graduation date:
16+
17+
Project Title: <Write your idea title>
18+
Relevant issues: <Add links to the relevant issues>
19+
20+
Idea description:
21+
<Write you thoughts below discussing your approach and how will you implement it>
22+
23+
```
24+
25+
- Feel free to add images by adding it to the `images` folder inside [doc/proposals/2025/gsoc](https://github.com/foss42/apidash/tree/main/doc/proposals/2025/gsoc) and linking it to your doc.
26+
- Finally, send you changes as a PR for review.

doc/user_guide/instructions_to_run_generated_code.md

Lines changed: 170 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,100 @@ Here are the detailed instructions for running the generated API Dash code in **
268268

269269
## Go (net/http)
270270

271-
TODO
271+
### 1. Install Go compiler
272+
273+
- Windows and MacOS: check out the [official source](https://go.dev/doc/install)
274+
- Linux: Install from your distro's package manager.
275+
276+
Verify if go is installed:
277+
278+
```bash
279+
go version
280+
```
281+
282+
### 2. Create a project
283+
```bash
284+
go mod init example.com/api
285+
```
286+
287+
### 3. Run the generated code
288+
- Paste the generated code into `main.go`.
289+
- Build and run by `go run main.go`.
272290
273291
## JavaScript (axios)
274292
275-
TODO
293+
The generated api code can be run in browser by using the code in an html file as demonstrated below:
294+
295+
### 1. Create the html file with generated code
296+
297+
Create a new file `index.html`
298+
299+
```html
300+
<!DOCTYPE html>
301+
<html>
302+
<head>
303+
<title>Axios Example</title>
304+
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
305+
</head>
306+
<body>
307+
<script>
308+
// Paste your API Dash generated code here !!
309+
</script>
310+
</body>
311+
</html>
312+
313+
```
314+
315+
Make sure to paste the generated js code from api dash under the `<script>` tag.
316+
317+
### 2. Test with Browser Developer Tools
318+
319+
Open the `index.html` file in a modern browser and open devtools.
320+
321+
- **Chrome**: Right-click the page and select "Inspect" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
322+
323+
- **Firefox**: Right-click the page and select "Inspect Element" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
324+
325+
- **Edge**: Right-click the page and select "Inspect" or press F12 or Ctrl+Shift+I.
326+
327+
Navigate to network tab and refresh the page to see the requests and network activity.
276328
277329
## JavaScript (fetch)
278330
279-
TODO
331+
The generated api code can be run in browser by using the code in an html file as demonstrated below:
332+
333+
### 1. Create the html file with generated code
334+
335+
Create a new file `index.html`
336+
337+
```html
338+
<!DOCTYPE html>
339+
<html>
340+
<head>
341+
<title>Fetch Example</title>
342+
</head>
343+
<body>
344+
<script>
345+
// Paste your API Dash generated code here !!
346+
</script>
347+
</body>
348+
</html>
349+
350+
```
351+
352+
Make sure to paste the generated js code from api dash under the `<script>` tag.
353+
354+
### 2. Test with Browser Developer Tools
355+
356+
Open the `index.html` file in a modern browser and open devtools.
357+
358+
- **Chrome**: Right-click the page and select "Inspect" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
359+
360+
- **Firefox**: Right-click the page and select "Inspect Element" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
361+
362+
- **Edge**: Right-click the page and select "Inspect" or press F12 or Ctrl+Shift+I.
363+
364+
Navigate to network tab and refresh the page to see the requests and network activity.
280365
281366
## node.js (JavaScript, axios)
282367
@@ -655,7 +740,88 @@ java -jar api_test.jar
655740

656741
## PHP (curl)
657742

658-
TODO
743+
Here are the detailed instructions for running the generated API Dash code in PHP (using `curl`) for macOS, Windows, and Linux:
744+
745+
### 1. Install and set PHP:
746+
Before starting out, we need to install PHP in our system.
747+
#### macOS:
748+
- Go to the official PHP website: [https://www.php.net/manual/en/install.macosx.php](https://www.php.net/manual/en/install.macosx.php)
749+
- Follow the installation instructions.
750+
751+
#### Windows:
752+
- Go to the official PHP website: [https://www.php.net/manual/en/install.windows.php](https://www.php.net/manual/en/install.windows.php)
753+
- Follow the installation instructions.
754+
755+
#### Linux:
756+
The installation process depends on your Linux distribution. Use the appropriate command below:
757+
- ##### Ubuntu/Debian
758+
```bash
759+
sudo apt update
760+
sudo apt install php php-cli php-curl php-mbstring php-xml php-zip -y
761+
```
762+
- ##### Arch Linux / Manjaro
763+
```bash
764+
sudo pacman -S php php-apache php-cgi php-curl php-mbstring php-xml php-zip
765+
```
766+
- ##### Fedora / CentOS
767+
```bash
768+
- sudo dnf install php php-cli php-curl php-mbstring php-xml php-zip -y
769+
```
770+
- ##### OpenSUSE
771+
```bash
772+
sudo zypper install php php-cli php-curl php-mbstring php-xml php-zip
773+
```
774+
775+
✅ Finally, check that everything works correctly pasting this command in your terminal
776+
```bash
777+
php --version
778+
```
779+
780+
### 2. Check cURL
781+
cURL is usually enabled by default. To check if it's active, run:
782+
```bash
783+
php -m | grep curl
784+
```
785+
and check if it returns **curl** as output
786+
787+
#### If curl is disabled
788+
789+
1. Open the `php.ini` configuration file. You can find its location by running:
790+
```bash
791+
php --ini
792+
```
793+
2. Open the file in a text editor/IDE
794+
3. Find this line
795+
```bash
796+
;extension=curl
797+
```
798+
4. Remove the semicolon (`;`) at the beginning to enable it:
799+
```bash
800+
extension=curl
801+
```
802+
5. Save and restart php by using
803+
```bash
804+
sudo systemctl restart apache2 # For Apache
805+
sudo systemctl restart php8.2-fpm # For PHP-FPM (Nginx)
806+
```
807+
808+
### 3. Execute the generated code:
809+
Once you have everything needed installed, follow these steps to execute the generated code:
810+
811+
1. **Open a IDE/text editor** ✍️ (Visual Studio, VS Code or any other text editor).
812+
2. **Create a php file ( ex. `request.php` )** ✍️ (Visual Studio, VS Code or any other text editor).
813+
3. **Copy and paste the generated API code** 📋 from API Dash into the `request.php` file.
814+
815+
#### In Visual Studio:
816+
1. Click the **Start Debugging `(F5)`** button from the top menu to run the project.
817+
2. The terminal will display the API response.
818+
819+
#### Using the CLI:
820+
1. Open the terminal at the project root directory and run the file you've created:
821+
```bash
822+
php filename.php
823+
```
824+
2. The terminal will display the API response.
659825

660826
## PHP (guzzle)
661827

lib/codegen/dart/dio.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:convert';
22
import 'package:apidash_core/apidash_core.dart';
33
import 'package:code_builder/code_builder.dart';
4+
import 'package:pub_semver/pub_semver.dart';
45
import 'package:dart_style/dart_style.dart';
56
import 'shared.dart';
67

@@ -141,7 +142,8 @@ class DartDioCodeGen {
141142
sbf.writeln(mainFunction.accept(emitter));
142143

143144
return DartFormatter(
144-
pageWidth: contentType == ContentType.formdata ? 70 : 160)
145-
.format(sbf.toString());
145+
languageVersion: Version(3, 2, 4),
146+
pageWidth: contentType == ContentType.formdata ? 70 : 160,
147+
).format(sbf.toString());
146148
}
147149
}

lib/codegen/dart/http.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'dart:convert';
22
import 'dart:io';
33
import 'package:apidash_core/apidash_core.dart';
44
import 'package:code_builder/code_builder.dart';
5+
import 'package:pub_semver/pub_semver.dart';
56
import 'package:dart_style/dart_style.dart';
67
import 'shared.dart';
78

@@ -225,7 +226,8 @@ class DartHttpCodeGen {
225226
sbf.writeln(mainFunction.accept(emitter));
226227

227228
return DartFormatter(
228-
pageWidth: contentType == ContentType.formdata ? 70 : 160)
229-
.format(sbf.toString());
229+
languageVersion: Version(3, 2, 4),
230+
pageWidth: contentType == ContentType.formdata ? 70 : 160,
231+
).format(sbf.toString());
230232
}
231233
}

0 commit comments

Comments
 (0)