@signe/schema-to-zod 1.4.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signe/schema-to-zod",
3
- "version": "1.4.1",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -162,16 +162,6 @@ function convertPropertyToZod(
162
162
  key: string,
163
163
  parentSchema: JSONSchema7
164
164
  ): ZodType<unknown> {
165
- if (schema.$ref) {
166
- return z.array(
167
- z.object({
168
- value: z.object({
169
- id: z.string()
170
- })
171
- })
172
- );
173
- }
174
-
175
165
  if (schema.type === 'object') {
176
166
  return z.object(jsonSchemaToZod(schema));
177
167
  }
@@ -188,6 +188,7 @@ describe('jsonSchemaToZod', () => {
188
188
  type: 'object',
189
189
  properties: {
190
190
  categories: {
191
+ type: 'string',
191
192
  $ref: '#/definitions/CategoryList'
192
193
  }
193
194
  }
@@ -196,9 +197,7 @@ describe('jsonSchemaToZod', () => {
196
197
  const zodSchema = z.object(jsonSchemaToZod(schema))
197
198
 
198
199
  expect(zodSchema.safeParse({
199
- categories: [
200
- { value: { id: '123' } }
201
- ]
200
+ categories: '123'
202
201
  }).success).toBeTruthy()
203
202
 
204
203
  expect(zodSchema.safeParse({