Skip to content

Commit

Permalink
Fix extends spread in getReferences (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachkirsch authored Sep 18, 2022
1 parent 873ed25 commit 5dc1a46
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,20 @@ exports[`ir simple 1`] = `
"name": "RecursiveType"
},
"shape": {
"extends": [],
"extends": [
{
"name": "CreateMovieRequest",
"fernFilepath": [
{
"originalValue": "imdb",
"camelCase": "imdb",
"snakeCase": "imdb",
"pascalCase": "Imdb",
"screamingSnakeCase": "IMDB"
}
]
}
],
"properties": [
{
"name": {
Expand Down Expand Up @@ -511,6 +524,18 @@ exports[`ir simple 1`] = `
"_type": "object"
},
"referencedTypes": [
{
"name": "CreateMovieRequest",
"fernFilepath": [
{
"originalValue": "imdb",
"camelCase": "imdb",
"snakeCase": "imdb",
"pascalCase": "Imdb",
"screamingSnakeCase": "IMDB"
}
]
},
{
"name": "RecursiveType",
"fernFilepath": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ types:
director: director.Director
producer: {}
RecursiveType:
extends: CreateMovieRequest
properties:
selfRefrencing: list<RecursiveType>
errors:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export function getReferencedTypesFromRawDeclaration({
object: (objectDeclaration) => {
const types: string[] = [];
if (objectDeclaration.extends != null) {
types.push(...objectDeclaration.extends);
const extendsArr =
typeof objectDeclaration.extends === "string"
? [objectDeclaration.extends]
: objectDeclaration.extends;
types.push(...extendsArr);
}
if (objectDeclaration.properties != null) {
types.push(
Expand Down

0 comments on commit 5dc1a46

Please sign in to comment.