| 57 | // occurrences of the string type with a custom keyword fjs_type |
| 58 | // (see https://github.com/fastify/fast-json-stringify/pull/441) |
| 59 | convertSchemaToAjvFormat (schema) { |
| 60 | if (schema === null) return |
| 61 | |
| 62 | if (schema.type === 'string') { |
| 63 | schema.fjs_type = 'string' |
| 64 | schema.type = ['string', 'object'] |
| 65 | } else if ( |
| 66 | Array.isArray(schema.type) && |
| 67 | schema.type.includes('string') && |
| 68 | !schema.type.includes('object') |
| 69 | ) { |
| 70 | schema.fjs_type = 'string' |
| 71 | schema.type.push('object') |
| 72 | } |
| 73 | for (const property in schema) { |
| 74 | if (typeof schema[property] === 'object') { |
| 75 | this.convertSchemaToAjvFormat(schema[property]) |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | getState () { |
| 81 | return { |