Skip to content

Commit

Permalink
fix: null violations error body fix (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelSuwinski authored Mar 6, 2024
1 parent b995088 commit a3fa99c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/hydra/fetchHydra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getDocumentationUrlFromHeaders,
} from '@api-platform/api-doc-parser';
import jsonld from 'jsonld';
import type { ContextDefinition, NodeObject } from 'jsonld';
import type { NodeObject } from 'jsonld';
import type { JsonLdObj } from 'jsonld/jsonld-spec';
import type { HttpClientOptions, HydraHttpClientResponse } from '../types.js';

Expand Down Expand Up @@ -55,13 +55,11 @@ function fetchHydra(
});
};

return documentLoader(getDocumentationUrlFromHeaders(headers))
.then((response) =>
jsonld.expand(body, {
expandContext: response.document as ContextDefinition,
}),
)

return jsonld
.expand(body, {
base: getDocumentationUrlFromHeaders(headers),
documentLoader,
})
.then((json) =>
Promise.reject(
new HttpError(
Expand Down

0 comments on commit a3fa99c

Please sign in to comment.