Skip to content

Commit

Permalink
chore: bump prisma dependency to 6.0.x (#1896)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 authored Dec 3, 2024
1 parent a747d95 commit ea72e9c
Show file tree
Hide file tree
Showing 25 changed files with 11,364 additions and 4,693 deletions.
40 changes: 20 additions & 20 deletions packages/plugins/openapi/tests/baseline/rpc-3.0.0.baseline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ components:
$ref: '#/components/schemas/Post_ItemListRelationFilter'
profile:
oneOf:
- $ref: '#/components/schemas/ProfileNullableRelationFilter'
- $ref: '#/components/schemas/ProfileNullableScalarRelationFilter'
- $ref: '#/components/schemas/ProfileWhereInput'
nullable: true
UserOrderByWithRelationInput:
Expand Down Expand Up @@ -241,7 +241,7 @@ components:
$ref: '#/components/schemas/Post_ItemListRelationFilter'
profile:
oneOf:
- $ref: '#/components/schemas/ProfileNullableRelationFilter'
- $ref: '#/components/schemas/ProfileNullableScalarRelationFilter'
- $ref: '#/components/schemas/ProfileWhereInput'
nullable: true
UserScalarWhereWithAggregatesInput:
Expand Down Expand Up @@ -319,7 +319,7 @@ components:
- type: string
user:
oneOf:
- $ref: '#/components/schemas/UserRelationFilter'
- $ref: '#/components/schemas/UserScalarRelationFilter'
- $ref: '#/components/schemas/UserWhereInput'
ProfileOrderByWithRelationInput:
type: object
Expand Down Expand Up @@ -364,7 +364,7 @@ components:
nullable: true
user:
oneOf:
- $ref: '#/components/schemas/UserRelationFilter'
- $ref: '#/components/schemas/UserScalarRelationFilter'
- $ref: '#/components/schemas/UserWhereInput'
ProfileScalarWhereWithAggregatesInput:
type: object
Expand Down Expand Up @@ -455,7 +455,7 @@ components:
nullable: true
author:
oneOf:
- $ref: '#/components/schemas/UserNullableRelationFilter'
- $ref: '#/components/schemas/UserNullableScalarRelationFilter'
- $ref: '#/components/schemas/UserWhereInput'
nullable: true
Post_ItemOrderByWithRelationInput:
Expand Down Expand Up @@ -538,7 +538,7 @@ components:
nullable: true
author:
oneOf:
- $ref: '#/components/schemas/UserNullableRelationFilter'
- $ref: '#/components/schemas/UserNullableScalarRelationFilter'
- $ref: '#/components/schemas/UserWhereInput'
nullable: true
Post_ItemScalarWhereWithAggregatesInput:
Expand Down Expand Up @@ -951,7 +951,7 @@ components:
$ref: '#/components/schemas/Post_ItemWhereInput'
none:
$ref: '#/components/schemas/Post_ItemWhereInput'
ProfileNullableRelationFilter:
ProfileNullableScalarRelationFilter:
type: object
properties:
is:
Expand Down Expand Up @@ -1105,7 +1105,7 @@ components:
- type: string
- $ref: '#/components/schemas/NestedStringNullableFilter'
nullable: true
UserRelationFilter:
UserScalarRelationFilter:
type: object
properties:
is:
Expand Down Expand Up @@ -1198,7 +1198,7 @@ components:
oneOf:
- type: integer
- $ref: '#/components/schemas/NestedIntFilter'
UserNullableRelationFilter:
UserNullableScalarRelationFilter:
type: object
properties:
is:
Expand Down Expand Up @@ -2660,14 +2660,14 @@ components:
- type: string
- $ref: '#/components/schemas/NullableStringFieldUpdateOperationsInput'
nullable: true
UserArgs:
UserDefaultArgs:
type: object
properties:
select:
$ref: '#/components/schemas/UserSelect'
include:
$ref: '#/components/schemas/UserInclude'
ProfileArgs:
ProfileDefaultArgs:
type: object
properties:
select:
Expand All @@ -2684,31 +2684,31 @@ components:
profile:
oneOf:
- type: boolean
- $ref: '#/components/schemas/ProfileArgs'
- $ref: '#/components/schemas/ProfileDefaultArgs'
_count:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserCountOutputTypeArgs'
- $ref: '#/components/schemas/UserCountOutputTypeDefaultArgs'
ProfileInclude:
type: object
properties:
user:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserArgs'
- $ref: '#/components/schemas/UserDefaultArgs'
Post_ItemInclude:
type: object
properties:
author:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserArgs'
- $ref: '#/components/schemas/UserDefaultArgs'
UserCountOutputTypeSelect:
type: object
properties:
posts:
type: boolean
UserCountOutputTypeArgs:
UserCountOutputTypeDefaultArgs:
type: object
properties:
select:
Expand All @@ -2733,11 +2733,11 @@ components:
profile:
oneOf:
- type: boolean
- $ref: '#/components/schemas/ProfileArgs'
- $ref: '#/components/schemas/ProfileDefaultArgs'
_count:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserCountOutputTypeArgs'
- $ref: '#/components/schemas/UserCountOutputTypeDefaultArgs'
ProfileSelect:
type: object
properties:
Expand All @@ -2748,7 +2748,7 @@ components:
user:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserArgs'
- $ref: '#/components/schemas/UserDefaultArgs'
userId:
type: boolean
Post_ItemSelect:
Expand All @@ -2765,7 +2765,7 @@ components:
author:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserArgs'
- $ref: '#/components/schemas/UserDefaultArgs'
authorId:
type: boolean
published:
Expand Down
40 changes: 20 additions & 20 deletions packages/plugins/openapi/tests/baseline/rpc-3.1.0.baseline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ components:
$ref: '#/components/schemas/Post_ItemListRelationFilter'
profile:
oneOf:
- $ref: '#/components/schemas/ProfileNullableRelationFilter'
- $ref: '#/components/schemas/ProfileNullableScalarRelationFilter'
- $ref: '#/components/schemas/ProfileWhereInput'
- type: 'null'
UserOrderByWithRelationInput:
Expand Down Expand Up @@ -244,7 +244,7 @@ components:
$ref: '#/components/schemas/Post_ItemListRelationFilter'
profile:
oneOf:
- $ref: '#/components/schemas/ProfileNullableRelationFilter'
- $ref: '#/components/schemas/ProfileNullableScalarRelationFilter'
- $ref: '#/components/schemas/ProfileWhereInput'
- type: 'null'
UserScalarWhereWithAggregatesInput:
Expand Down Expand Up @@ -322,7 +322,7 @@ components:
- type: string
user:
oneOf:
- $ref: '#/components/schemas/UserRelationFilter'
- $ref: '#/components/schemas/UserScalarRelationFilter'
- $ref: '#/components/schemas/UserWhereInput'
ProfileOrderByWithRelationInput:
type: object
Expand Down Expand Up @@ -367,7 +367,7 @@ components:
- type: 'null'
user:
oneOf:
- $ref: '#/components/schemas/UserRelationFilter'
- $ref: '#/components/schemas/UserScalarRelationFilter'
- $ref: '#/components/schemas/UserWhereInput'
ProfileScalarWhereWithAggregatesInput:
type: object
Expand Down Expand Up @@ -458,7 +458,7 @@ components:
- type: 'null'
author:
oneOf:
- $ref: '#/components/schemas/UserNullableRelationFilter'
- $ref: '#/components/schemas/UserNullableScalarRelationFilter'
- $ref: '#/components/schemas/UserWhereInput'
- type: 'null'
Post_ItemOrderByWithRelationInput:
Expand Down Expand Up @@ -541,7 +541,7 @@ components:
- type: 'null'
author:
oneOf:
- $ref: '#/components/schemas/UserNullableRelationFilter'
- $ref: '#/components/schemas/UserNullableScalarRelationFilter'
- $ref: '#/components/schemas/UserWhereInput'
- type: 'null'
Post_ItemScalarWhereWithAggregatesInput:
Expand Down Expand Up @@ -959,7 +959,7 @@ components:
$ref: '#/components/schemas/Post_ItemWhereInput'
none:
$ref: '#/components/schemas/Post_ItemWhereInput'
ProfileNullableRelationFilter:
ProfileNullableScalarRelationFilter:
type: object
properties:
is:
Expand Down Expand Up @@ -1116,7 +1116,7 @@ components:
- type: string
- $ref: '#/components/schemas/NestedStringNullableFilter'
- type: 'null'
UserRelationFilter:
UserScalarRelationFilter:
type: object
properties:
is:
Expand Down Expand Up @@ -1212,7 +1212,7 @@ components:
oneOf:
- type: integer
- $ref: '#/components/schemas/NestedIntFilter'
UserNullableRelationFilter:
UserNullableScalarRelationFilter:
type: object
properties:
is:
Expand Down Expand Up @@ -2689,14 +2689,14 @@ components:
- type: string
- $ref: '#/components/schemas/NullableStringFieldUpdateOperationsInput'
- type: 'null'
UserArgs:
UserDefaultArgs:
type: object
properties:
select:
$ref: '#/components/schemas/UserSelect'
include:
$ref: '#/components/schemas/UserInclude'
ProfileArgs:
ProfileDefaultArgs:
type: object
properties:
select:
Expand All @@ -2713,31 +2713,31 @@ components:
profile:
oneOf:
- type: boolean
- $ref: '#/components/schemas/ProfileArgs'
- $ref: '#/components/schemas/ProfileDefaultArgs'
_count:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserCountOutputTypeArgs'
- $ref: '#/components/schemas/UserCountOutputTypeDefaultArgs'
ProfileInclude:
type: object
properties:
user:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserArgs'
- $ref: '#/components/schemas/UserDefaultArgs'
Post_ItemInclude:
type: object
properties:
author:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserArgs'
- $ref: '#/components/schemas/UserDefaultArgs'
UserCountOutputTypeSelect:
type: object
properties:
posts:
type: boolean
UserCountOutputTypeArgs:
UserCountOutputTypeDefaultArgs:
type: object
properties:
select:
Expand All @@ -2762,11 +2762,11 @@ components:
profile:
oneOf:
- type: boolean
- $ref: '#/components/schemas/ProfileArgs'
- $ref: '#/components/schemas/ProfileDefaultArgs'
_count:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserCountOutputTypeArgs'
- $ref: '#/components/schemas/UserCountOutputTypeDefaultArgs'
ProfileSelect:
type: object
properties:
Expand All @@ -2777,7 +2777,7 @@ components:
user:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserArgs'
- $ref: '#/components/schemas/UserDefaultArgs'
userId:
type: boolean
Post_ItemSelect:
Expand All @@ -2794,7 +2794,7 @@ components:
author:
oneOf:
- type: boolean
- $ref: '#/components/schemas/UserArgs'
- $ref: '#/components/schemas/UserDefaultArgs'
authorId:
type: boolean
published:
Expand Down
23 changes: 12 additions & 11 deletions packages/plugins/openapi/tests/openapi-rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import OpenAPIParser from '@readme/openapi-parser';
import { getLiteral, getObjectLiteral } from '@zenstackhq/sdk';
import { Model, Plugin, isPlugin } from '@zenstackhq/sdk/ast';
import { loadZModelAndDmmf, normalizePath } from '@zenstackhq/testtools';
import { loadSchema, loadZModelAndDmmf, normalizePath } from '@zenstackhq/testtools';
import fs from 'fs';
import path from 'path';
import * as tmp from 'tmp';
Expand All @@ -17,11 +17,13 @@ describe('Open API Plugin RPC Tests', () => {
it('run plugin', async () => {
for (const specVersion of ['3.0.0', '3.1.0']) {
for (const omitInputDetails of [true, false]) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
const { projectDir } = await loadSchema(
`
plugin openapi {
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
omitInputDetails = ${omitInputDetails}
output = '$projectRoot/openapi.yaml'
}
enum role {
Expand Down Expand Up @@ -89,18 +91,17 @@ model Bar {
id String @id
@@ignore
}
`);

const { name: output } = tmp.fileSync({ postfix: '.yaml' });

const options = buildOptions(model, modelFile, output);
await generate(model, options, dmmf);
`,
{ provider: 'postgresql', pushDb: false }
);

console.log(
`OpenAPI specification generated for ${specVersion}${omitInputDetails ? ' - omit' : ''}: ${output}`
`OpenAPI specification generated for ${specVersion}${
omitInputDetails ? ' - omit' : ''
}: ${projectDir}/openapi.yaml`
);

const parsed = YAML.parse(fs.readFileSync(output, 'utf-8'));
const parsed = YAML.parse(fs.readFileSync(path.join(projectDir, 'openapi.yaml'), 'utf-8'));
expect(parsed.openapi).toBe(specVersion);
const baseline = YAML.parse(
fs.readFileSync(
Expand All @@ -110,7 +111,7 @@ model Bar {
);
expect(parsed).toMatchObject(baseline);

const api = await OpenAPIParser.validate(output);
const api = await OpenAPIParser.validate(path.join(projectDir, 'openapi.yaml'));

expect(api.tags).toEqual(
expect.arrayContaining([
Expand Down
Loading

0 comments on commit ea72e9c

Please sign in to comment.