Skip to content
New issue

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is JsonNullValueInput ? #209

Closed
Tracked by #216
gaetschwartz opened this issue Apr 28, 2023 · 4 comments
Closed
Tracked by #216

What is JsonNullValueInput ? #209

gaetschwartz opened this issue Apr 28, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@gaetschwartz
Copy link

gaetschwartz commented Apr 28, 2023

When generating the models, it generated this Create class for my model Accountconnection, but instead of dynamic (which would represent a json object) that I expected, it takes JsonNullValueInput as an argument for the data field.

model AccountConnection {
  id             String         @id @db.Uuid
  user_id        String         @db.Uuid
  account_id     String
  provider       String
  data           Json           @db.Json
  email          String?
  users          CalendyUser    @relation(fields: [user_id], references: [user_id], onDelete: NoAction, onUpdate: NoAction)
  user_calendars UserCalendar[]

  @@unique([account_id, user_id, provider], map: "account_connections_unique_constraint")
  @@map("account_connections")
}
enum JsonNullValueInput implements _i1.PrismaEnum {
  @JsonValue('JsonNull')
  jsonNull('JsonNull');

  const JsonNullValueInput([this.originalName]);

  @override
  final String? originalName;
}

/.../

@_i1.jsonSerializable
class AccountConnectionCreateInput implements _i1.JsonSerializable {
  const AccountConnectionCreateInput({
    required this.id,
    required this.accountId,
    required this.provider,
    required this.data,
    this.email,
    required this.users,
    this.userCalendars,
  });

  factory AccountConnectionCreateInput.fromJson(Map<String, dynamic> json) =>
      _$AccountConnectionCreateInputFromJson(json);

  final String id;

  @JsonKey(name: 'account_id')
  final String accountId;

  final String provider;

  final JsonNullValueInput data;

  final String? email;

  final CalendyUserCreateNestedOneWithoutAccountConnectionsInput users;

  @JsonKey(name: 'user_calendars')
  final UserCalendarCreateNestedManyWithoutAccountConnectionsInput?
      userCalendars;

  @override
  Map<String, dynamic> toJson() => _$AccountConnectionCreateInputToJson(this);
}

The regular class is generated correctly though.

@_i1.jsonSerializable
class AccountConnection implements _i1.JsonSerializable {
  const AccountConnection({
    required this.id,
    required this.userId,
    required this.accountId,
    required this.provider,
    required this.data,
    this.email,
  });

  factory AccountConnection.fromJson(Map<String, dynamic> json) =>
      _$AccountConnectionFromJson(json);

  final String id;

  @JsonKey(name: 'user_id')
  final String userId;

  @JsonKey(name: 'account_id')
  final String accountId;

  final String provider;

  final dynamic data;

  final String? email;

  @override
  Map<String, dynamic> toJson() => _$AccountConnectionToJson(this);
}
@medz medz added the bug Something isn't working label May 2, 2023
@medz
Copy link
Owner

medz commented May 4, 2023

@gaetschwartz Can you create a minimal example for me? so that I can investigate this issue.

Also: #212

@gaetschwartz
Copy link
Author

@medz https://github.com/gaetschwartz/example, here it is :)

@medz medz mentioned this issue May 18, 2023
7 tasks
@medz
Copy link
Owner

medz commented May 23, 2023

@gaetschwartz Fixed in 3.3.2 version 😊

@medz medz closed this as completed May 23, 2023
@medz
Copy link
Owner

medz commented May 23, 2023

Sorry, I haven't been able to fix bugs quickly since last month, but I will try my best to find time to fix bugs and release fixed versions. thanks for waiting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants