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

Version/2.1.0 prerelease.8 #222

Merged
merged 8 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 2.1.0-prerelease.8

* Fixed Issue ([#221](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/221))
* Added generation of int get hashCode
* Added example

# 2.1.0-prerelease.7

* Fixed Issue ([#186](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/186))
* Fixed Issue ([#204](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/204))

# 2.1.0-prerelease.6

* **BREAKING**: Added dollar signs to generated converter and mappings
Expand Down
113 changes: 113 additions & 0 deletions example/lib/example_swagger.swagger
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"
}
}
}
}
}
1 change: 1 addition & 0 deletions example/lib/swagger_generated_code/client_index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'example_swagger.swagger.dart' show ExampleSwagger;
5 changes: 5 additions & 0 deletions example/lib/swagger_generated_code/client_mapping.dart
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,
};
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);
}
}
Loading