-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added dollars to all generated classes like mappings and jsonSerializable converter * Fixed some things * Updated changelog and pubspec * Added example Added generation of get hashCode * Removed build_only_models parameter * Fixed tests Co-authored-by: uladzimir_paliukhovich <>
- Loading branch information
1 parent
3494b7d
commit 74cb318
Showing
17 changed files
with
555 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
{ | ||
"openapi": "3.0.3", | ||
"info": { | ||
"title": "Generated API", | ||
"version": "1.0" | ||
}, | ||
"tags": [ | ||
{ | ||
"name": "tag1" | ||
}, | ||
{ | ||
"name": "tag2" | ||
} | ||
], | ||
"paths": { | ||
"/rooms": { | ||
"get": { | ||
"operationId": "getRooms", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "Rooms owner", | ||
"name": "id", | ||
"in": "query", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Loaded rooms", | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/room" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/api/item/all": { | ||
"get": { | ||
"tags": [ | ||
"tag1" | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/ListCustomItem" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"room": { | ||
"type": "object", | ||
"properties": { | ||
"author": { | ||
"description": "UUIDv4 of author of last message", | ||
"type": "string" | ||
}, | ||
"avatar": { | ||
"description": "UUIDv4 of fake user as avatar of room", | ||
"type": "string" | ||
}, | ||
"id": { | ||
"description": "UUIDv4 of room", | ||
"type": "string" | ||
}, | ||
"lastMessage": { | ||
"description": "Last message payload", | ||
"type": "string" | ||
}, | ||
"name": { | ||
"description": "Fake user name as room name", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"CustomItem": { | ||
"type": "object", | ||
"properties": { | ||
"available": { | ||
"type": "boolean" | ||
}, | ||
"description": { | ||
"type": "string" | ||
}, | ||
"id": { | ||
"type": "string" | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"ListCustomItem": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/components/schemas/CustomItem" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'example_swagger.swagger.dart' show ExampleSwagger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'example_swagger.swagger.dart'; | ||
|
||
final Map<Type, Object Function(Map<String, dynamic>)> generatedMapping = { | ||
...ExampleSwaggerJsonDecoderMappings, | ||
}; |
33 changes: 33 additions & 0 deletions
33
example/lib/swagger_generated_code/example_swagger.swagger.chopper2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//Generated code | ||
|
||
part of 'example_swagger.swagger.dart'; | ||
|
||
// ************************************************************************** | ||
// ChopperGenerator | ||
// ************************************************************************** | ||
|
||
// ignore_for_file: always_put_control_body_on_new_line, always_specify_types, prefer_const_declarations | ||
class _$ExampleSwagger extends ExampleSwagger { | ||
_$ExampleSwagger([ChopperClient? client]) { | ||
if (client == null) return; | ||
this.client = client; | ||
} | ||
|
||
@override | ||
final definitionType = ExampleSwagger; | ||
|
||
@override | ||
Future<Response<List<Room>>> roomsGet({required String? id}) { | ||
final $url = '/rooms'; | ||
final $params = <String, dynamic>{'id': id}; | ||
final $request = Request('GET', $url, client.baseUrl, parameters: $params); | ||
return client.send<List<Room>, Room>($request); | ||
} | ||
|
||
@override | ||
Future<Response<ListCustomItem>> apiItemAllGet() { | ||
final $url = '/api/item/all'; | ||
final $request = Request('GET', $url, client.baseUrl); | ||
return client.send<ListCustomItem, ListCustomItem>($request); | ||
} | ||
} |
Oops, something went wrong.