Skip to content

Commit

Permalink
fix: if audience is filtering and no audiences exist on environments,…
Browse files Browse the repository at this point in the history
… add all environments (#4220)
  • Loading branch information
RohinBhargava authored Aug 6, 2024
1 parent 2df58ae commit 24d2d00
Show file tree
Hide file tree
Showing 10 changed files with 6,370 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: api
environments:
Production: https://www.yoursite.com
Staging: https://www.staging.yoursite.com
error-discrimination:
strategy: status-code
audiences:
- external
- internal
- development
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

service:
auth: false
base-path: /movies
endpoints:
createMovie:
audiences:
- external
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
webhooks:
userAdded:
audiences:
- external
display-name: User Added
method: POST
payload: User

userDeleted:
display-name: User Added
method: POST
payload: User

types:
User:
properties:
name: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"organization": "dsinghvi",
"version": "0.30.7"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
default-group: local
groups:
local:
audiences:
- external
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.9.5
output:
location: local-file-system
path: ../sdks/typescript
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ it("environments no audiences", async () => {
});
});

it("environments no audiences on environments but all hack", async () => {
const AUDIENCES_DIR = path.join(__dirname, "fixtures/audiences/fern-hack-override-environment-audience");
await generateAndSnapshotIRFromPath({
absolutePathToIr: AbsoluteFilePath.of(IR_DIR),
absolutePathToWorkspace: AbsoluteFilePath.of(AUDIENCES_DIR),
audiences: { type: "all" },
workspaceName: "environmentAudiencesAllHack"
});
});

it("environments no audiences on environments but selected hack", async () => {
const AUDIENCES_DIR = path.join(__dirname, "fixtures/audiences/fern-hack-override-environment-audience");
await generateAndSnapshotIRFromPath({
absolutePathToIr: AbsoluteFilePath.of(IR_DIR),
absolutePathToWorkspace: AbsoluteFilePath.of(AUDIENCES_DIR),
audiences: { type: "select", audiences: ["external"] },
workspaceName: "environmentAudiencesSelectHack"
});
});

it("fhir", async () => {
const FHIR_DIR = path.join(__dirname, "../../../../../../fern/apis/fhir");
await generateAndSnapshotIRFromPath({
Expand Down
Loading

0 comments on commit 24d2d00

Please sign in to comment.