Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"bugs": "https://github.com/the-codegen-project/cli/issues",
"dependencies": {
"@asyncapi/avro-schema-parser": "^3.0.24",
"@asyncapi/modelina": "^5.7.2",
"@asyncapi/modelina": "^6.0.0-next.3",
"@asyncapi/openapi-schema-parser": "^3.0.24",
"@asyncapi/parser": "^3.4.0",
"@asyncapi/protobuf-schema-parser": "^3.5.1",
Expand Down
7 changes: 4 additions & 3 deletions src/codegen/inputs/asyncapi/generators/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ export function unwrap(channelParameters: ConstrainedObjectModel) {
if(${variableName} && ${variableName} !== '') {
parameters.${parameter.propertyName} = ${variableName} as any
} else {
throw new Error(\`Parameter: '${parameter.propertyName}' is not valid. Abort! \`)
throw new Error(\`Parameter: '${parameter.propertyName}' is not valid in ${channelParameters.name}. Aborting parameter extracting! \`)
}`;
}
);

const parameterInitializer = Object.values(channelParameters.properties).map(
(parameter) => {
const parameterInitializer = Object.values(channelParameters.properties)
.filter(parameter => parameter.property.options.const?.value === undefined)
.map((parameter) => {
if (parameter.property.options.isNullable) {
return `${parameter.propertyName}: null`;
}
Expand Down
3 changes: 1 addition & 2 deletions src/codegen/inputs/asyncapi/generators/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export interface ProcessedPayloadSchemaData {
operationPayloads: Record<string, {schema: any; schemaId: string}>;
otherPayloads: {schema: any; schemaId: string}[];
}
const processor = new AsyncAPIInputProcessor();
// AsyncAPI input processor

// eslint-disable-next-line sonarjs/cognitive-complexity
export async function processAsyncAPIPayloads(
asyncapiDocument: AsyncAPIDocumentInterface
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export interface LoadArgument {
export type SupportedLanguages = 'typescript';
export interface GenericCodegenContext {
dependencyOutputs: Record<string, any>;
config: TheCodegenConfiguration;
config?: TheCodegenConfiguration;
}

export const zodAsyncAPITypeScriptGenerators = z.discriminatedUnion('preset', [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`channels typescript should work with basic AsyncAPI inputs 1`] = `
"import * as TestPayloadModelModule from './../../../../TestPayloadModel';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`headers typescript should work with OpenAPI 2.0 inputs 1`] = `
"import {Ajv, Options as AjvOptions, ErrorObject, ValidateFunction} from 'ajv';
Expand Down
Loading