-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): generate fdr definition id (#4754)
- Loading branch information
Showing
8 changed files
with
158 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/cli/ete-tests/src/tests/generate/fixtures/basic/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sdks/ |
3 changes: 3 additions & 0 deletions
3
packages/cli/ete-tests/src/tests/generate/fixtures/basic/fern/definition/api.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: api | ||
error-discrimination: | ||
strategy: status-code |
60 changes: 60 additions & 0 deletions
60
packages/cli/ete-tests/src/tests/generate/fixtures/basic/fern/definition/imdb.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json | ||
|
||
service: | ||
auth: false | ||
base-path: /movies | ||
endpoints: | ||
createMovie: | ||
docs: Add a movie to the database | ||
method: POST | ||
path: /create-movie | ||
request: CreateMovieRequest | ||
response: MovieId | ||
|
||
getMovie: | ||
docs: Retrieve a movie from the database based on the ID | ||
method: GET | ||
path: /{id} | ||
path-parameters: | ||
id: MovieId | ||
response: Movie | ||
errors: | ||
- MovieDoesNotExistError | ||
examples: | ||
# Success response | ||
- path-parameters: | ||
id: tt0111161 | ||
response: | ||
body: | ||
id: tt0111161 | ||
title: The Shawshank Redemption | ||
rating: 9.3 | ||
# Error response | ||
- path-parameters: | ||
id: tt1234 | ||
response: | ||
error: MovieDoesNotExistError | ||
body: tt1234 | ||
|
||
types: | ||
MovieId: | ||
type: string | ||
docs: The unique identifier for a Movie in the database | ||
|
||
Movie: | ||
properties: | ||
id: MovieId | ||
title: string | ||
rating: | ||
type: double | ||
docs: The rating scale out of ten stars | ||
|
||
CreateMovieRequest: | ||
properties: | ||
title: string | ||
rating: double | ||
|
||
errors: | ||
MovieDoesNotExistError: | ||
status-code: 404 | ||
type: MovieId |
4 changes: 4 additions & 0 deletions
4
packages/cli/ete-tests/src/tests/generate/fixtures/basic/fern/fern.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"organization": "dsinghvi", | ||
"version": "*" | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/cli/ete-tests/src/tests/generate/fixtures/basic/fern/generators.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
default-group: local | ||
groups: | ||
local: | ||
generators: | ||
- name: fernapi/fern-typescript-node-sdk | ||
version: 0.39.3 | ||
output: | ||
location: local-file-system | ||
path: ../sdks/typescript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/cli/ete-tests/src/tests/generate/ir-contains-fdr-definition-id.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
# Check if a file name is provided | ||
if [ $# -eq 0 ]; then | ||
echo "Error: No file provided" | ||
echo "Usage: $0 <json_file>" | ||
exit 1 | ||
fi | ||
|
||
# Store the file name | ||
file="$1" | ||
|
||
# Check if the file exists | ||
if [ ! -f "$file" ]; then | ||
echo "Error: File '$file' not found" | ||
exit 1 | ||
fi | ||
|
||
# Use jq to check if "fdrApiDefinitionId" key exists | ||
if cat "$file" | jq 'has("fdrApiDefinitionId")' | grep -q true; then | ||
echo "Success: 'fdrApiDefinitionId' key found in $file" | ||
exit 0 | ||
else | ||
echo "Failure: 'fdrApiDefinitionId' key not found in $file" | ||
exit 1 | ||
fi |