Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

deprecated test extend #367

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 7.3.1-beta

- deprecated test extend

## 7.3.0-beta

- package update
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: artemis
version: 7.3.0-beta
version: 7.3.1-beta

description: Build dart types from GraphQL schemas and queries (using Introspection Query).
homepage: https://github.com/comigor/artemis
Expand Down
43 changes: 16 additions & 27 deletions test/query_generator/deprecated/deprecated_enum_value_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void main() {

enum StarWarsMovies {
NEW_HOPE @deprecated(reason: "deprecated movie")
EMPIRE
EMPIRE @deprecated
JEDI
}
''',
Expand All @@ -42,41 +42,29 @@ const query = r'''
final LibraryDefinition libraryDefinition =
LibraryDefinition(basename: r'query.graphql', queries: [
QueryDefinition(
document: parseString(query),
name: QueryName(name: r'SomeQuery$_QueryResponse'),
operationName: 'some_query',
operationName: r'some_query',
classes: [
EnumDefinition(
name: EnumName(name: r'StarWarsMovies'),
values: [
EnumValueDefinition(
name: EnumValueName(name: 'NEW_HOPE'),
annotations: [
r"Deprecated('deprecated movie')",
],
),
EnumValueDefinition(
name: EnumValueName(name: 'EMPIRE'),
),
EnumValueDefinition(
name: EnumValueName(name: 'JEDI'),
),
EnumValueDefinition(
name: EnumValueName(name: 'ARTEMIS_UNKNOWN'),
),
],
),
EnumDefinition(name: EnumName(name: r'StarWarsMovies'), values: [
EnumValueDefinition(
name: EnumValueName(name: r'NEW_HOPE'),
annotations: [r'''Deprecated('deprecated movie')''']),
EnumValueDefinition(
name: EnumValueName(name: r'EMPIRE'),
annotations: [r'''Deprecated('No longer supported')''']),
EnumValueDefinition(name: EnumValueName(name: r'JEDI')),
EnumValueDefinition(name: EnumValueName(name: r'ARTEMIS_UNKNOWN'))
]),
ClassDefinition(
name: ClassName(name: r'SomeQuery$_QueryResponse'),
properties: [
ClassProperty(
type: TypeName(name: r'StarWarsMovies'),
name: ClassPropertyName(name: r'someValue'),
// isOverride: false,

annotations: [
r'JsonKey(unknownEnumValue: StarWarsMovies.artemisUnknown)',
])
r'JsonKey(unknownEnumValue: StarWarsMovies.artemisUnknown)'
],
isResolveType: false)
],
factoryPossibilities: {},
typeNameField: ClassPropertyName(name: r'__typename'),
Expand Down Expand Up @@ -114,6 +102,7 @@ enum StarWarsMovies {
@Deprecated('deprecated movie')
@JsonValue('NEW_HOPE')
newHope,
@Deprecated('No longer supported')
@JsonValue('EMPIRE')
empire,
@JsonValue('JEDI')
Expand Down
10 changes: 8 additions & 2 deletions test/query_generator/deprecated/deprecated_field_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ void main() {

type QueryResponse {
someObject: SomeObject @deprecated(reason: "message")
someObjects: [SomeObject]
someObjects: [SomeObject] @deprecated
}

type SomeObject {
someField: String
someField: String @deprecated
deprecatedField: String @deprecated(reason: "message 2")
}
''',
Expand Down Expand Up @@ -57,6 +57,7 @@ final LibraryDefinition libraryDefinition =
ClassProperty(
type: DartTypeName(name: r'String'),
name: ClassPropertyName(name: r'someField'),
annotations: [r'''Deprecated('No longer supported')'''],
isResolveType: false),
ClassProperty(
type: DartTypeName(name: r'String'),
Expand All @@ -73,6 +74,7 @@ final LibraryDefinition libraryDefinition =
ClassProperty(
type: DartTypeName(name: r'String'),
name: ClassPropertyName(name: r'someField'),
annotations: [r'''Deprecated('No longer supported')'''],
isResolveType: false),
ClassProperty(
type: DartTypeName(name: r'String'),
Expand All @@ -98,6 +100,7 @@ final LibraryDefinition libraryDefinition =
name: r'SomeQuery$_QueryResponse$_SomeObject'),
isNonNull: false),
name: ClassPropertyName(name: r'someObjects'),
annotations: [r'''Deprecated('No longer supported')'''],
isResolveType: false)
],
factoryPossibilities: {},
Expand Down Expand Up @@ -125,6 +128,7 @@ class SomeQuery$QueryResponse$DeprecatedObject extends JsonSerializable
Map<String, dynamic> json) =>
_$SomeQuery$QueryResponse$DeprecatedObjectFromJson(json);

@Deprecated('No longer supported')
String? someField;

@Deprecated('message 2')
Expand All @@ -146,6 +150,7 @@ class SomeQuery$QueryResponse$SomeObject extends JsonSerializable
Map<String, dynamic> json) =>
_$SomeQuery$QueryResponse$SomeObjectFromJson(json);

@Deprecated('No longer supported')
String? someField;

@Deprecated('message 2')
Expand All @@ -168,6 +173,7 @@ class SomeQuery$QueryResponse extends JsonSerializable with EquatableMixin {
@Deprecated('message')
SomeQuery$QueryResponse$DeprecatedObject? deprecatedObject;

@Deprecated('No longer supported')
List<SomeQuery$QueryResponse$SomeObject?>? someObjects;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void main() {
}

input Input {
s: String!
s: String! @deprecated
d: String @deprecated(reason: "deprecated input field")
}
''',
Expand Down Expand Up @@ -78,6 +78,7 @@ final LibraryDefinition libraryDefinition =
ClassProperty(
type: DartTypeName(name: r'String', isNonNull: true),
name: ClassPropertyName(name: r's'),
annotations: [r'''Deprecated('No longer supported')'''],
isResolveType: false),
ClassProperty(
type: DartTypeName(name: r'String'),
Expand Down Expand Up @@ -146,6 +147,7 @@ class Input extends JsonSerializable with EquatableMixin {

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

@Deprecated('No longer supported')
late String s;

@Deprecated('deprecated input field')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final String graphQLSchema = r'''
}

interface Node {
id: ID!
id: ID! @deprecated
deprecatedField: String @deprecated(reason: "deprecated interface field")
}

Expand Down Expand Up @@ -114,6 +114,7 @@ final LibraryDefinition libraryDefinition =
ClassProperty(
type: DartTypeName(name: r'String', isNonNull: true),
name: ClassPropertyName(name: r'id'),
annotations: [r'''Deprecated('No longer supported')'''],
isResolveType: false),
ClassProperty(
type: DartTypeName(name: r'String'),
Expand Down Expand Up @@ -239,6 +240,7 @@ class Custom$Query$Node extends JsonSerializable with EquatableMixin {
return _$Custom$Query$NodeFromJson(json);
}

@Deprecated('No longer supported')
late String id;

@Deprecated('deprecated interface field')
Expand Down