We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey there! First of all Whow 馃く So great utility plugin ! really powerfull and easy to use! you are typescript ninjas ! Great job !
Here is my issue. I'm using AJV format like this
import addFormat from 'ajv-formats' import {FromSchema} from 'json-schema-to-ts'; export const validateParameters = ( parametersData: any, schema: any ) => { const ajv = new Ajv({ allErrors: true, removeAdditional: 'all', coerceTypes: true, unicodeRegExp: false, }); addFormat(ajv); ...
Here is my schema code:
{ type: 'object', properties: { supplierInvoiceFile: { type: 'object', properties: { type: {type: 'string'}, filename: {type: 'string'}, contentType: {type: 'string'}, content: {type: 'binary', contentMediaType: 'application/pdf'}, }, }, } }
and here is the calling code :
const body = parse(event, true) as FromSchema<typeof schema>; //error /** * Type '{ readonly type: "object"; readonly properties: { readonly isTest: { readonly type: "boolean"; readonly default: false; }; * readonly supplierInvoiceFile: { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; }; readonly * filename: { ...; }; readonly contentType: { ...; }; readonly...' does not satisfy the constraint 'JSONSchema'.ts(2344) **/
As soon as the property content is equal to "binary" it seems that the FromSchema is broken.
Is this a normal behavior as the support for binary type is not provided ? Or am I doing something wrong ?
Thanks for your answer !
The text was updated successfully, but these errors were encountered:
Sorry for the timeloss... I figured out by re reading the json schema docs The proper syntax is :
supplierInvoiceFile: { type: 'object', properties: { type: {type: 'string'}, filename: {type: 'string'}, contentType: {type: 'string'}, content: {type: 'string', contentEncoding:'binary', contentMediaType: 'application/pdf'}, }, },
Sorry, something went wrong.
No branches or pull requests
Hey there!
First of all Whow 馃く So great utility plugin ! really powerfull and easy to use! you are typescript ninjas !
Great job !
Here is my issue.
I'm using AJV format like this
Here is my schema code:
and here is the calling code :
As soon as the property content is equal to "binary" it seems that the FromSchema is broken.
Is this a normal behavior as the support for binary type is not provided ? Or am I doing something wrong ?
Thanks for your answer !
The text was updated successfully, but these errors were encountered: