Skip to content

Commit

Permalink
testing still fails on full run
Browse files Browse the repository at this point in the history
Signed-off-by: Harald Fischer <[email protected]>
  • Loading branch information
fisehara committed Feb 5, 2024
1 parent 6b03113 commit f3705bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/sbvr-api/sbvr-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import {
setExecutedMigrations,
} from '../migrator/utils';
import { generateODataMetadata } from '../odata-metadata/odata-metadata-generator';
import { metadataEndpoints } from './uri-parser';

const LF2AbstractSQLTranslator = LF2AbstractSQL.createTranslator(sbvrTypes);
const LF2AbstractSQLTranslatorVersion = `${LF2AbstractSQLVersion}+${sbvrTypesVersion}`;
Expand Down Expand Up @@ -1274,7 +1275,8 @@ const runODataRequest = (req: Express.Request, vocabulary: string) => {
const resolvedResourceName = resolveSynonym($request);
if (
abstractSqlModel.tables[resolvedResourceName] == null &&
!resolvedResourceName.endsWith('#canAccess')
!resolvedResourceName.endsWith('#canAccess') &&
!metadataEndpoints.includes(resolvedResourceName)
) {
throw new UnauthorizedError();
}
Expand Down
7 changes: 4 additions & 3 deletions test/08-metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ describe('08 metadata / openAPI spec', function () {
.expect(200);
expect(body).to.be.an('object');

await writeFileSync('openApiSpec.json', JSON.stringify(body, null, 2));
const bodySpec = JSON.stringify(body, null, 2);
await writeFileSync('openApiSpe-full.json', bodySpec);

// validate the openAPI spec and expect no validator errors.
try {
const apiSpec = await OpenAPIParser.validate(body);
console.log(`apiSpec:${JSON.stringify(apiSpec, null, 2)}`);
const apiSpec = await OpenAPIParser.validate(JSON.parse(bodySpec));
expect(apiSpec).to.be.an('object');
} catch (err) {
console.log(`err:${JSON.stringify(err, null, 2)}`);
expect(err).to.be.undefined;
}
});
Expand Down

0 comments on commit f3705bb

Please sign in to comment.