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
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,6 @@ Connect AI assistants like Claude Code, Cursor, and Windsurf to The Codegen Proj






1 change: 1 addition & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,6 @@ Prefix that follows specification is not enough though. Remember that the title






1 change: 1 addition & 0 deletions docs/migrations/v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,6 @@ import * as NodeFetch from 'node-fetch';






8 changes: 4 additions & 4 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $ npm install -g @the-codegen-project/cli
$ codegen COMMAND
running command...
$ codegen (--version)
@the-codegen-project/cli/0.79.0 darwin-arm64 node-v24.15.0
@the-codegen-project/cli/0.80.0 linux-x64 node-v22.23.1
$ codegen --help [COMMAND]
USAGE
$ codegen COMMAND
Expand Down Expand Up @@ -93,7 +93,7 @@ DESCRIPTION
configuration.
```

_See code: [src/commands/generate.ts](https://github.com/the-codegen-project/cli/blob/v0.79.0/src/commands/generate.ts)_
_See code: [src/commands/generate.ts](https://github.com/the-codegen-project/cli/blob/v0.80.0/src/commands/generate.ts)_

## `codegen help [COMMAND]`

Expand Down Expand Up @@ -167,7 +167,7 @@ DESCRIPTION
Initialize The Codegen Project in your project
```

_See code: [src/commands/init.ts](https://github.com/the-codegen-project/cli/blob/v0.79.0/src/commands/init.ts)_
_See code: [src/commands/init.ts](https://github.com/the-codegen-project/cli/blob/v0.80.0/src/commands/init.ts)_

## `codegen telemetry ACTION`

Expand Down Expand Up @@ -200,7 +200,7 @@ EXAMPLES
$ codegen telemetry disable
```

_See code: [src/commands/telemetry.ts](https://github.com/the-codegen-project/cli/blob/v0.79.0/src/commands/telemetry.ts)_
_See code: [src/commands/telemetry.ts](https://github.com/the-codegen-project/cli/blob/v0.80.0/src/commands/telemetry.ts)_

## `codegen version`

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import {Ajv, Options as AjvOptions, ErrorObject, ValidateFunction} from 'ajv';
import {default as addFormats} from 'ajv-formats';
class OrderCancelledHeaders {
private _xCorrelationId: string;
private _xOrderId: string;
private _xCustomerId: string;
private _xSourceService?: string;
private _additionalProperties?: Map<string, any>;

constructor(input: {
xCorrelationId: string,
xOrderId: string,
xCustomerId: string,
xSourceService?: string,
additionalProperties?: Map<string, any>,
}) {
this._xCorrelationId = input.xCorrelationId;
this._xOrderId = input.xOrderId;
this._xCustomerId = input.xCustomerId;
this._xSourceService = input.xSourceService;
this._additionalProperties = input.additionalProperties;
}

get xCorrelationId(): string { return this._xCorrelationId; }
set xCorrelationId(xCorrelationId: string) { this._xCorrelationId = xCorrelationId; }

get xOrderId(): string { return this._xOrderId; }
set xOrderId(xOrderId: string) { this._xOrderId = xOrderId; }

get xCustomerId(): string { return this._xCustomerId; }
set xCustomerId(xCustomerId: string) { this._xCustomerId = xCustomerId; }

get xSourceService(): string | undefined { return this._xSourceService; }
set xSourceService(xSourceService: string | undefined) { this._xSourceService = xSourceService; }

get additionalProperties(): Map<string, any> | undefined { return this._additionalProperties; }
set additionalProperties(additionalProperties: Map<string, any> | undefined) { this._additionalProperties = additionalProperties; }

public toJson(): Record<string, unknown> {
const json: Record<string, unknown> = {};
if(this.xCorrelationId !== undefined) {
json["x-correlation-id"] = this.xCorrelationId;
}
if(this.xOrderId !== undefined) {
json["x-order-id"] = this.xOrderId;
}
if(this.xCustomerId !== undefined) {
json["x-customer-id"] = this.xCustomerId;
}
if(this.xSourceService !== undefined) {
json["x-source-service"] = this.xSourceService;
}
if(this.additionalProperties !== undefined) {
for (const [key, value] of this.additionalProperties.entries()) {
//Only unwrap those that are not already a property in the JSON object
if(["x-correlation-id","x-order-id","x-customer-id","x-source-service","additionalProperties"].includes(String(key))) continue;
json[key] = value;
}
}
return json;
}

public marshal(): string {
return JSON.stringify(this.toJson());
}

public static fromJson(obj: Record<string, unknown>): OrderCancelledHeaders {
const instance = new OrderCancelledHeaders({} as any);

if (obj["x-correlation-id"] !== undefined) {
instance.xCorrelationId = obj["x-correlation-id"] as string;
}
if (obj["x-order-id"] !== undefined) {
instance.xOrderId = obj["x-order-id"] as string;
}
if (obj["x-customer-id"] !== undefined) {
instance.xCustomerId = obj["x-customer-id"] as string;
}
if (obj["x-source-service"] !== undefined) {
instance.xSourceService = obj["x-source-service"] as string;
}

instance.additionalProperties = new Map();
const propsToCheck = Object.entries(obj).filter((([key,]) => {return !["x-correlation-id","x-order-id","x-customer-id","x-source-service","additionalProperties"].includes(key);}));
for (const [key, value] of propsToCheck) {
instance.additionalProperties.set(key, value as any);
}
return instance;
}

public static unmarshal(json: string | object): OrderCancelledHeaders {
const obj = typeof json === "object" ? json : JSON.parse(json);
return OrderCancelledHeaders.fromJson(obj as Record<string, unknown>);
}
public static theCodeGenSchema = {"type":"object","required":["x-correlation-id","x-order-id","x-customer-id"],"properties":{"x-correlation-id":{"type":"string","format":"uuid"},"x-order-id":{"type":"string","format":"uuid"},"x-customer-id":{"type":"string","format":"uuid"},"x-source-service":{"type":"string"}},"$id":"OrderCancelledHeaders","$schema":"http://json-schema.org/draft-07/schema"};
public static validate(context?: {data: any, ajvValidatorFunction?: ValidateFunction, ajvInstance?: Ajv, ajvOptions?: AjvOptions}): { valid: boolean; errors?: ErrorObject[]; } {
const {data, ajvValidatorFunction} = context ?? {};
// Intentionally parse JSON strings to support validation of marshalled output.
// Example: validate({data: marshal(obj)}) works because marshal returns JSON string.
// Note: String 'true' will be coerced to boolean true due to JSON.parse.
const parsedData = typeof data === 'string' ? JSON.parse(data) : data;
const validate = ajvValidatorFunction ?? this.createValidator(context)
return {
valid: validate(parsedData),
errors: validate.errors ?? undefined,
};
}
public static createValidator(context?: {ajvInstance?: Ajv, ajvOptions?: AjvOptions}): ValidateFunction {
const {ajvInstance} = {...context ?? {}, ajvInstance: new Ajv(context?.ajvOptions ?? {})};
addFormats(ajvInstance);

const validate = ajvInstance.compile(this.theCodeGenSchema);
return validate;
}

}
export { OrderCancelledHeaders };
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import {Ajv, Options as AjvOptions, ErrorObject, ValidateFunction} from 'ajv';
import {default as addFormats} from 'ajv-formats';
class OrderCreatedHeaders {
private _xCorrelationId: string;
private _xOrderId: string;
private _xCustomerId: string;
private _xSourceService?: string;
private _additionalProperties?: Map<string, any>;

constructor(input: {
xCorrelationId: string,
xOrderId: string,
xCustomerId: string,
xSourceService?: string,
additionalProperties?: Map<string, any>,
}) {
this._xCorrelationId = input.xCorrelationId;
this._xOrderId = input.xOrderId;
this._xCustomerId = input.xCustomerId;
this._xSourceService = input.xSourceService;
this._additionalProperties = input.additionalProperties;
}

get xCorrelationId(): string { return this._xCorrelationId; }
set xCorrelationId(xCorrelationId: string) { this._xCorrelationId = xCorrelationId; }

get xOrderId(): string { return this._xOrderId; }
set xOrderId(xOrderId: string) { this._xOrderId = xOrderId; }

get xCustomerId(): string { return this._xCustomerId; }
set xCustomerId(xCustomerId: string) { this._xCustomerId = xCustomerId; }

get xSourceService(): string | undefined { return this._xSourceService; }
set xSourceService(xSourceService: string | undefined) { this._xSourceService = xSourceService; }

get additionalProperties(): Map<string, any> | undefined { return this._additionalProperties; }
set additionalProperties(additionalProperties: Map<string, any> | undefined) { this._additionalProperties = additionalProperties; }

public toJson(): Record<string, unknown> {
const json: Record<string, unknown> = {};
if(this.xCorrelationId !== undefined) {
json["x-correlation-id"] = this.xCorrelationId;
}
if(this.xOrderId !== undefined) {
json["x-order-id"] = this.xOrderId;
}
if(this.xCustomerId !== undefined) {
json["x-customer-id"] = this.xCustomerId;
}
if(this.xSourceService !== undefined) {
json["x-source-service"] = this.xSourceService;
}
if(this.additionalProperties !== undefined) {
for (const [key, value] of this.additionalProperties.entries()) {
//Only unwrap those that are not already a property in the JSON object
if(["x-correlation-id","x-order-id","x-customer-id","x-source-service","additionalProperties"].includes(String(key))) continue;
json[key] = value;
}
}
return json;
}

public marshal(): string {
return JSON.stringify(this.toJson());
}

public static fromJson(obj: Record<string, unknown>): OrderCreatedHeaders {
const instance = new OrderCreatedHeaders({} as any);

if (obj["x-correlation-id"] !== undefined) {
instance.xCorrelationId = obj["x-correlation-id"] as string;
}
if (obj["x-order-id"] !== undefined) {
instance.xOrderId = obj["x-order-id"] as string;
}
if (obj["x-customer-id"] !== undefined) {
instance.xCustomerId = obj["x-customer-id"] as string;
}
if (obj["x-source-service"] !== undefined) {
instance.xSourceService = obj["x-source-service"] as string;
}

instance.additionalProperties = new Map();
const propsToCheck = Object.entries(obj).filter((([key,]) => {return !["x-correlation-id","x-order-id","x-customer-id","x-source-service","additionalProperties"].includes(key);}));
for (const [key, value] of propsToCheck) {
instance.additionalProperties.set(key, value as any);
}
return instance;
}

public static unmarshal(json: string | object): OrderCreatedHeaders {
const obj = typeof json === "object" ? json : JSON.parse(json);
return OrderCreatedHeaders.fromJson(obj as Record<string, unknown>);
}
public static theCodeGenSchema = {"type":"object","required":["x-correlation-id","x-order-id","x-customer-id"],"properties":{"x-correlation-id":{"type":"string","format":"uuid"},"x-order-id":{"type":"string","format":"uuid"},"x-customer-id":{"type":"string","format":"uuid"},"x-source-service":{"type":"string"}},"$id":"OrderCreatedHeaders","$schema":"http://json-schema.org/draft-07/schema"};
public static validate(context?: {data: any, ajvValidatorFunction?: ValidateFunction, ajvInstance?: Ajv, ajvOptions?: AjvOptions}): { valid: boolean; errors?: ErrorObject[]; } {
const {data, ajvValidatorFunction} = context ?? {};
// Intentionally parse JSON strings to support validation of marshalled output.
// Example: validate({data: marshal(obj)}) works because marshal returns JSON string.
// Note: String 'true' will be coerced to boolean true due to JSON.parse.
const parsedData = typeof data === 'string' ? JSON.parse(data) : data;
const validate = ajvValidatorFunction ?? this.createValidator(context)
return {
valid: validate(parsedData),
errors: validate.errors ?? undefined,
};
}
public static createValidator(context?: {ajvInstance?: Ajv, ajvOptions?: AjvOptions}): ValidateFunction {
const {ajvInstance} = {...context ?? {}, ajvInstance: new Ajv(context?.ajvOptions ?? {})};
addFormats(ajvInstance);

const validate = ajvInstance.compile(this.theCodeGenSchema);
return validate;
}

}
export { OrderCreatedHeaders };
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {OrderCreatedHeaders} from './OrderCreatedHeaders';
import {OrderUpdatedHeaders} from './OrderUpdatedHeaders';
import {OrderCancelledHeaders} from './OrderCancelledHeaders';
type OrderLifecycleHeaders = OrderCreatedHeaders | OrderUpdatedHeaders | OrderCancelledHeaders;
export { OrderLifecycleHeaders };
Loading
Loading