Skip to content

Commit

Permalink
fix compile breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
RohinBhargava committed Jan 15, 2025
1 parent ca005e1 commit a11d543
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ describe("MultipartFormDataPropertySchemaConverterNode", () => {
const result = converter.convert();
expect(result).toEqual({
type: "alias",
value: { type: "primitive", value: { type: "base64" } },
value: {
type: "primitive",
value: { type: "base64", mimeType: "image/jpeg" },
},
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class StringConverterNode extends BaseOpenApiV3_1ConverterNodeWithExample
minLength: number | undefined;
maxLength: number | undefined;
enum: EnumConverterNode | undefined;
mimeType: string | undefined;

constructor(
args: BaseOpenApiV3_1ConverterNodeConstructorArgs<StringConverterNode.Input>
Expand Down Expand Up @@ -108,6 +109,8 @@ export class StringConverterNode extends BaseOpenApiV3_1ConverterNodeWithExample
this.minLength = this.input.minLength;
this.maxLength = this.input.maxLength;

this.mimeType = this.input.contentMediaType;

if (this.input.default != null && typeof this.input.default !== "string") {
this.context.errors.warning({
message: `Expected default value to be a string. Received ${this.input.default}`,
Expand Down Expand Up @@ -154,14 +157,21 @@ export class StringConverterNode extends BaseOpenApiV3_1ConverterNodeWithExample
type: "alias",
value: {
type: "primitive",
value: {
type,
format: type === "string" ? this.format : undefined,
regex: this.regex,
minLength: this.minLength,
maxLength: this.maxLength,
default: this.default,
},
value:
type === "base64"
? {
type,
mimeType: this.mimeType,
default: this.default,
}
: {
type,
format: type === "string" ? this.format : undefined,
regex: this.regex,
minLength: this.minLength,
maxLength: this.maxLength,
default: this.default,
},
},
};
}
Expand Down

0 comments on commit a11d543

Please sign in to comment.