Skip to content

Commit

Permalink
fix(core/transform): fixes response normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Oct 16, 2019
1 parent c68dade commit 5bde885
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/src/transform/normalize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
isElementType,
isElementService,
isElementTree,
isTreeCollection
isTreeCollection,
isTypeResponse
} from '~/inspect/is';

export interface NormalizeTransformOptions {
Expand Down Expand Up @@ -90,11 +91,11 @@ export function normalize<T extends CollectionTree>(
}

if (isElementType(element)) {
if (element.kind !== 'response' || !element.children) {
if (!isTypeResponse(element) || !element.children) {
return element;
}

const response = { ...element, children: element.children };
const response = { ...element, children: { ...element.children } };
for (const [key, service] of Object.entries(element.children)) {
response.children[key] = normalizeServiceTypes(
name + transform(key, false),
Expand Down

0 comments on commit 5bde885

Please sign in to comment.