Options.mjs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. export const ignoreOverride = Symbol('Let zodToJsonSchema decide on which parser to use');
  2. const defaultOptions = {
  3. name: undefined,
  4. $refStrategy: 'root',
  5. effectStrategy: 'input',
  6. pipeStrategy: 'all',
  7. dateStrategy: 'format:date-time',
  8. mapStrategy: 'entries',
  9. nullableStrategy: 'from-target',
  10. removeAdditionalStrategy: 'passthrough',
  11. definitionPath: 'definitions',
  12. target: 'jsonSchema7',
  13. strictUnions: false,
  14. errorMessages: false,
  15. markdownDescription: false,
  16. patternStrategy: 'escape',
  17. applyRegexFlags: false,
  18. emailStrategy: 'format:email',
  19. base64Strategy: 'contentEncoding:base64',
  20. nameStrategy: 'ref',
  21. };
  22. export const getDefaultOptions = (options) => {
  23. // We need to add `definitions` here as we may mutate it
  24. return (typeof options === 'string' ?
  25. {
  26. ...defaultOptions,
  27. basePath: ['#'],
  28. definitions: {},
  29. name: options,
  30. }
  31. : {
  32. ...defaultOptions,
  33. basePath: ['#'],
  34. definitions: {},
  35. ...options,
  36. });
  37. };
  38. //# sourceMappingURL=Options.mjs.map