Skip to content

Commit f3705bb

Browse files
committed
testing still fails on full run
Signed-off-by: Harald Fischer <[email protected]>
1 parent 6b03113 commit f3705bb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/sbvr-api/sbvr-utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ import {
101101
setExecutedMigrations,
102102
} from '../migrator/utils';
103103
import { generateODataMetadata } from '../odata-metadata/odata-metadata-generator';
104+
import { metadataEndpoints } from './uri-parser';
104105

105106
const LF2AbstractSQLTranslator = LF2AbstractSQL.createTranslator(sbvrTypes);
106107
const LF2AbstractSQLTranslatorVersion = `${LF2AbstractSQLVersion}+${sbvrTypesVersion}`;
@@ -1274,7 +1275,8 @@ const runODataRequest = (req: Express.Request, vocabulary: string) => {
12741275
const resolvedResourceName = resolveSynonym($request);
12751276
if (
12761277
abstractSqlModel.tables[resolvedResourceName] == null &&
1277-
!resolvedResourceName.endsWith('#canAccess')
1278+
!resolvedResourceName.endsWith('#canAccess') &&
1279+
!metadataEndpoints.includes(resolvedResourceName)
12781280
) {
12791281
throw new UnauthorizedError();
12801282
}

test/08-metadata.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ describe('08 metadata / openAPI spec', function () {
3434
.expect(200);
3535
expect(body).to.be.an('object');
3636

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

3940
// validate the openAPI spec and expect no validator errors.
4041
try {
41-
const apiSpec = await OpenAPIParser.validate(body);
42-
console.log(`apiSpec:${JSON.stringify(apiSpec, null, 2)}`);
42+
const apiSpec = await OpenAPIParser.validate(JSON.parse(bodySpec));
4343
expect(apiSpec).to.be.an('object');
4444
} catch (err) {
45+
console.log(`err:${JSON.stringify(err, null, 2)}`);
4546
expect(err).to.be.undefined;
4647
}
4748
});

0 commit comments

Comments
 (0)