Custom EventBridge Schema Registry - Cannot export JSONSchemaDraft4 for non discovered or non aws managed schemas
See original GitHub issueHave you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Description
When setting up the generator with a custom registryName
(other than discovered-schemas
),
running npm run generate
will yield the following exception:
ForbiddenException: You cannot export non discovered or non aws managed schemas.
This seems to be due to the usage of exportSchema()
on every returned schema by default (verified with Python boto3.schemas lib too).
We might need to make this feature optional or add a condition on the registryType
.
Steps to reproduce
- Create a custom EventBridge Schema Registry
- Create a new Schema in your new EventBridge Schema Registry
- Set the generator to point to the custom EventBridge Schema Registry (
registryName
)
generators: [
[
'@eventcatalog/plugin-doc-generator-amazon-eventbridge',
{
eventBusName: 'MyEventBus',
region: 'eu-west-2',
registryName: 'MySchemaRegistry',
schemaTypeToRenderToEvent: 'OpenAPI',
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
},
},
],
]
- Run
npm run generate
Expected behavior
As for the default discovered-schemas
registry, we expect listed schemas to be mapped into new events/
directories containing the templated markdown docs.
In the case of a custom EventBridge Schema Registry, the documentation could be templated without exporting the JSONSchemaDraft4 schema files.
Actual behavior
a 403 ForbiddenException: You cannot export non discovered or non aws managed schemas
exception is thrown.
Generating EventCatalog docs using: @eventcatalog/plugin-doc-generator-amazon-eventbridge
/Users/john/my-event-catalog/node_modules/@aws-sdk/client-schemas/dist-cjs/protocols/Aws_restJson1.js:2888
const exception = new models_0_1.ForbiddenException({
^
ForbiddenException: You cannot export non discovered or non aws managed schemas.
at deserializeAws_restJson1ForbiddenExceptionResponse (/Users/john/my-event-catalog/node_modules/@aws-sdk/client-schemas/dist-cjs/protocols/Aws_restJson1.js:2888:23)
at deserializeAws_restJson1ExportSchemaCommandError (/Users/john/my-event-catalog/node_modules/@aws-sdk/client-schemas/dist-cjs/protocols/Aws_restJson1.js:1815:25)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /Users/john/my-event-catalog/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
at async /Users/john/my-event-catalog/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:11:20
at async StandardRetryStrategy.retry (/Users/john/my-event-catalog/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:51:46)
at async /Users/john/my-event-catalog/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22
at async /Users/john/my-event-catalog/node_modules/@eventcatalog/plugin-doc-generator-amazon-eventbridge/lib/lib/aws.js:12:30
at async Promise.all (index 0)
at async exports.default (/Users/john/my-event-catalog/node_modules/@eventcatalog/plugin-doc-generator-amazon-eventbridge/lib/index.js:38:21) {
'$fault': 'client',
'$metadata': {
httpStatusCode: 403,
requestId: '4526e20b-4fbd-44a9-9a72-4bd4d427e791',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
Code: 'Forbidden'
}
Error: Command failed: cross-env PROJECT_DIR=/Users/john/my-event-catalog npm run generate
at checkExecSyncError (node:child_process:826:11)
at execSync (node:child_process:900:15)
at Command.<anonymous> (/Users/john/my-event-catalog/node_modules/@eventcatalog/core/bin/eventcatalog.js:108:5)
at Command.listener [as _actionHandler] (/Users/john/my-event-catalog/node_modules/commander/index.js:922:31)
at Command._parseCommand (/Users/john/my-event-catalog/node_modules/commander/index.js:1503:14)
at Command._dispatchSubcommand (/Users/john/my-event-catalog/node_modules/commander/index.js:1443:18)
at Command._parseCommand (/Users/john/my-event-catalog/node_modules/commander/index.js:1460:12)
at Command.parse (/Users/john/my-event-catalog/node_modules/commander/index.js:1292:10)
at run (/Users/john/my-event-catalog/node_modules/@eventcatalog/core/bin/eventcatalog.js:115:7)
at Object.<anonymous> (/Users/john/my-event-catalog/node_modules/@eventcatalog/core/bin/eventcatalog.js:122:1) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 36420,
stdout: null,
stderr: null
}
Your environment
- EventCatalog version used: 0.0.6
- Environment name and version: Chrome 100.0.4896.127, Node.js 16.13.2
- Operating system and version: MacOS 12.3.1
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Hey @frenayj ,
Yeah this is very interesting indeed! Will take a look around and explore abit more, but as you said if we cannot get it I think having some condition in there would be good too. Guess would mean less hydration for you, but would make things work…
Ah o no @frenayj , any idea what kind of issues you were seeing?