forked from loafle/openapi-generator-original
update dart, ruby petstore samples
This commit is contained in:
parent
91bd7ac3b9
commit
a59c325cb7
@ -1 +1 @@
|
|||||||
2.3.1
|
2.4.0-SNAPSHOT
|
@ -59,7 +59,7 @@ try {
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
@ -213,7 +213,7 @@ try {
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class ApiClient {
|
|||||||
final _RegList = new RegExp(r'^List<(.*)>$');
|
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||||
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
||||||
|
|
||||||
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
|
ApiClient({this.basePath: "http://localhost/v2"}) {
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
||||||
_authentications['petstore_auth'] = new OAuth();
|
_authentications['petstore_auth'] = new OAuth();
|
||||||
@ -149,4 +149,12 @@ class ApiClient {
|
|||||||
auth.applyToParams(queryParams, headerParams);
|
auth.applyToParams(queryParams, headerParams);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAccessToken(String accessToken) {
|
||||||
|
_authentications.forEach((key, auth) {
|
||||||
|
if (auth is OAuth) {
|
||||||
|
auth.setAccessToken(accessToken);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
part of swagger.api;
|
part of swagger.api;
|
||||||
|
|
||||||
class OAuth implements Authentication {
|
class OAuth implements Authentication {
|
||||||
|
String accessToken;
|
||||||
|
|
||||||
|
OAuth({this.accessToken}) {
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||||
// TODO: support oauth
|
if (accessToken != null) {
|
||||||
|
headerParams["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
2.3.1
|
2.4.0-SNAPSHOT
|
@ -59,7 +59,7 @@ try {
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
@ -213,7 +213,7 @@ try {
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class ApiClient {
|
|||||||
final _RegList = new RegExp(r'^List<(.*)>$');
|
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||||
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
||||||
|
|
||||||
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
|
ApiClient({this.basePath: "http://localhost/v2"}) {
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
||||||
_authentications['petstore_auth'] = new OAuth();
|
_authentications['petstore_auth'] = new OAuth();
|
||||||
@ -149,4 +149,12 @@ class ApiClient {
|
|||||||
auth.applyToParams(queryParams, headerParams);
|
auth.applyToParams(queryParams, headerParams);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAccessToken(String accessToken) {
|
||||||
|
_authentications.forEach((key, auth) {
|
||||||
|
if (auth is OAuth) {
|
||||||
|
auth.setAccessToken(accessToken);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
part of swagger.api;
|
part of swagger.api;
|
||||||
|
|
||||||
class OAuth implements Authentication {
|
class OAuth implements Authentication {
|
||||||
|
String accessToken;
|
||||||
|
|
||||||
|
OAuth({this.accessToken}) {
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||||
// TODO: support oauth
|
if (accessToken != null) {
|
||||||
|
headerParams["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
2.3.1
|
2.4.0-SNAPSHOT
|
@ -59,7 +59,7 @@ try {
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:swagger/api.dart';
|
import 'package:swagger/api.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
@ -213,7 +213,7 @@ try {
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class ApiClient {
|
|||||||
final _RegList = new RegExp(r'^List<(.*)>$');
|
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||||
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
||||||
|
|
||||||
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
|
ApiClient({this.basePath: "http://localhost/v2"}) {
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
||||||
_authentications['petstore_auth'] = new OAuth();
|
_authentications['petstore_auth'] = new OAuth();
|
||||||
@ -149,4 +149,12 @@ class ApiClient {
|
|||||||
auth.applyToParams(queryParams, headerParams);
|
auth.applyToParams(queryParams, headerParams);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAccessToken(String accessToken) {
|
||||||
|
_authentications.forEach((key, auth) {
|
||||||
|
if (auth is OAuth) {
|
||||||
|
auth.setAccessToken(accessToken);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
part of swagger.api;
|
part of swagger.api;
|
||||||
|
|
||||||
class OAuth implements Authentication {
|
class OAuth implements Authentication {
|
||||||
|
String accessToken;
|
||||||
|
|
||||||
|
OAuth({this.accessToken}) {
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||||
// TODO: support oauth
|
if (accessToken != null) {
|
||||||
|
headerParams["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license)
|
||||||
|
# Automatically generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen)
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: 2.2
|
TargetRubyVersion: 2.2
|
||||||
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
||||||
# to ignore them, so only the ones explicitly set in this file are enabled.
|
# to ignore them, so only the ones explicitly set in this file are enabled.
|
||||||
DisabledByDefault: true
|
DisabledByDefault: true
|
||||||
Exclude:
|
Exclude:
|
||||||
- '**/spec/**/*'
|
|
||||||
- '**/templates/**/*'
|
- '**/templates/**/*'
|
||||||
- '**/vendor/**/*'
|
- '**/vendor/**/*'
|
||||||
- 'actionpack/lib/action_dispatch/journey/parser.rb'
|
- 'actionpack/lib/action_dispatch/journey/parser.rb'
|
||||||
@ -113,9 +114,9 @@ Layout/SpaceInsideParens:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
# Check quotes usage according to lint rule below.
|
# Check quotes usage according to lint rule below.
|
||||||
Style/StringLiterals:
|
#Style/StringLiterals:
|
||||||
Enabled: true
|
# Enabled: true
|
||||||
EnforcedStyle: single_quotes
|
# EnforcedStyle: single_quotes
|
||||||
|
|
||||||
# Detect hard tabs, no hard tabs.
|
# Detect hard tabs, no hard tabs.
|
||||||
Layout/Tab:
|
Layout/Tab:
|
||||||
|
@ -12,6 +12,8 @@ Method | HTTP request | Description
|
|||||||
|
|
||||||
To test class name in snake case
|
To test class name in snake case
|
||||||
|
|
||||||
|
To test class name in snake case
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```ruby
|
```ruby
|
||||||
# load the gem
|
# load the gem
|
||||||
|
@ -20,6 +20,7 @@ module Petstore
|
|||||||
@api_client = api_client
|
@api_client = api_client
|
||||||
end
|
end
|
||||||
# To test class name in snake case
|
# To test class name in snake case
|
||||||
|
# To test class name in snake case
|
||||||
# @param body client model
|
# @param body client model
|
||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
# @return [Client]
|
# @return [Client]
|
||||||
@ -28,6 +29,7 @@ module Petstore
|
|||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# To test class name in snake case
|
||||||
# To test class name in snake case
|
# To test class name in snake case
|
||||||
# @param body client model
|
# @param body client model
|
||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
|
@ -248,7 +248,7 @@ module Petstore
|
|||||||
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
||||||
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
||||||
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
||||||
'explicitly with `tempfile.delete`'
|
"explicitly with `tempfile.delete`"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
|
||||||
=begin
|
=begin
|
||||||
#Swagger Petstore
|
#Swagger Petstore
|
||||||
|
|
||||||
@ -24,8 +24,7 @@ Gem::Specification.new do |s|
|
|||||||
s.homepage = "https://github.com/swagger-api/swagger-codegen"
|
s.homepage = "https://github.com/swagger-api/swagger-codegen"
|
||||||
s.summary = "Swagger Petstore Ruby Gem"
|
s.summary = "Swagger Petstore Ruby Gem"
|
||||||
s.description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\"
|
s.description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\"
|
||||||
# TODO uncomment and update below with a proper license
|
s.license = "Unlicense"
|
||||||
#s.license = "Apache 2.0"
|
|
||||||
s.required_ruby_version = ">= 1.9"
|
s.required_ruby_version = ">= 1.9"
|
||||||
|
|
||||||
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
||||||
@ -39,7 +38,7 @@ Gem::Specification.new do |s|
|
|||||||
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
||||||
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
|
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
|
||||||
|
|
||||||
s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
|
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
|
||||||
s.test_files = `find spec/*`.split("\n")
|
s.test_files = `find spec/*`.split("\n")
|
||||||
s.executables = []
|
s.executables = []
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user