Skip to content

Commit

Permalink
Regenerate all samples
Browse files Browse the repository at this point in the history
Scripted via `make regenerate-samples`
  • Loading branch information
macisamuele committed Feb 3, 2020
1 parent ddffb02 commit 4a9fbf9
Show file tree
Hide file tree
Showing 36 changed files with 492 additions and 1,406 deletions.
23 changes: 23 additions & 0 deletions samples/generated-code/src/main/java/.swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@

package com.yelp.codegen.generatecodesamples.apis

import okhttp3.RequestBody

import com.yelp.codegen.generatecodesamples.models.Pet
import io.reactivex.Single
import retrofit2.http.GET
import retrofit2.http.Headers

@JvmSuppressWildcards
interface DefaultApi {
/**
* Find pet by ID
* Returns a single pet
* The endpoint is owned by generatecodesamples service owner
* @param petId ID of pet to return (required)
*/
@Headers(
"X-Operation-ID: getPetById"
)
@GET("/pet/{petId}")
fun getPetById(
@retrofit2.http.Path("petId") petId: Long
): Single<Pet>
/**
* Find pet by ID
* Returns a single pet
* The endpoint is owned by generatecodesamples service owner
* @param petId ID of pet to return (required)
*/
@Headers(
"X-Operation-ID: getPetById"
)
@GET("/pet/{petId}")
fun getPetById(
@retrofit2.http.Path("petId") petId: Long
): Single<Pet>

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
package com.yelp.codegen.generatecodesamples.models

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* A Category used to group pets
* @property id Unique ID of the Category
* @property name Name of this category
*/
data class Category(
@Json(name = "id") @field:Json(name = "id") var id: Long? = null,
@Json(name = "name") @field:Json(name = "name") var name: String? = null
@JsonClass(generateAdapter = true)
data class Category (
@Json(name = "id") @field:Json(name = "id") var id: Long? = null,
@Json(name = "name") @field:Json(name = "name") var name: String? = null
)

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package com.yelp.codegen.generatecodesamples.models

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* Represents a specific Pet in the store
Expand All @@ -16,10 +17,12 @@ import com.squareup.moshi.Json
* @property photoUrls Photo URls for this Pet on the bucket
* @property tags Pet status in the store
*/
data class Pet(
@Json(name = "name") @field:Json(name = "name") var name: String,
@Json(name = "photoUrls") @field:Json(name = "photoUrls") var photoUrls: List<String>,
@Json(name = "category") @field:Json(name = "category") var category: Category? = null,
@Json(name = "id") @field:Json(name = "id") var id: Long? = null,
@Json(name = "tags") @field:Json(name = "tags") var tags: List<Tag>? = null
@JsonClass(generateAdapter = true)
data class Pet (
@Json(name = "name") @field:Json(name = "name") var name: String,
@Json(name = "photoUrls") @field:Json(name = "photoUrls") var photoUrls: List<String>,
@Json(name = "category") @field:Json(name = "category") var category: Category? = null,
@Json(name = "id") @field:Json(name = "id") var id: Long? = null,
@Json(name = "tags") @field:Json(name = "tags") var tags: List<Tag>? = null
)

Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
package com.yelp.codegen.generatecodesamples.models

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* A Tag used to group entities
* @property id Unique ID of the Tag
* @property name Name of this Tag
*/
data class Tag(
@Json(name = "id") @field:Json(name = "id") var id: Long? = null,
@Json(name = "name") @field:Json(name = "name") var name: String? = null
@JsonClass(generateAdapter = true)
data class Tag (
@Json(name = "id") @field:Json(name = "id") var id: Long? = null,
@Json(name = "name") @field:Json(name = "name") var name: String? = null
)

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ package com.yelp.codegen.generatecodesamples.tools
@Retention(AnnotationRetention.RUNTIME)
annotation class CSV


@Target(AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER)
@Retention(AnnotationRetention.RUNTIME)
annotation class SSV


@Target(AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER)
@Retention(AnnotationRetention.RUNTIME)
annotation class TSV


@Target(AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER)
@Retention(AnnotationRetention.RUNTIME)
annotation class PIPES
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import retrofit2.Converter
import retrofit2.converter.moshi.MoshiConverterFactory


object GeneratedCodeConverters {
private val moshi = Moshi.Builder()
.add(XNullableAdapterFactory())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ class XNullableAdapterFactory : JsonAdapter.Factory {
nextAdapter?.toJson(writer, value)
}
}

}
}
return null
}

private fun Set<Annotation>.removeXNullableAnnotation(): MutableSet<out Annotation> {
private fun Set<Annotation>.removeXNullableAnnotation():MutableSet<out Annotation>{
return this.filter { it !is XNullable }.toMutableSet()
}
}
105 changes: 1 addition & 104 deletions samples/generated-code/src/main/java/swagger.json
Original file line number Diff line number Diff line change
@@ -1,104 +1 @@
{
"definitions": {
"Category": {
"description": "A Category used to group pets",
"properties": {
"id": {
"description": "Unique ID of the Category",
"format": "int64",
"type": "integer"
},
"name": {
"description": "Name of this category",
"type": "string"
}
},
"type": "object"
},
"Pet": {
"description": "Represents a specific Pet in the store",
"properties": {
"category": {
"$ref": "#/definitions/Category",
"description": "Optional category of the pet"
},
"id": {
"description": "Unique ID of this Pet",
"format": "int64",
"type": "integer"
},
"name": {
"description": "Name of this specific pet",
"type": "string"
},
"photoUrls": {
"description": "Photo URls for this Pet on the bucket",
"items": {
"type": "string"
},
"type": "array"
},
"tags": {
"description": "Pet status in the store",
"items": {
"$ref": "#/definitions/Tag"
},
"type": "array"
}
},
"required": [
"name",
"photoUrls"
],
"type": "object"
},
"Tag": {
"description": "A Tag used to group entities",
"properties": {
"id": {
"description": "Unique ID of the Tag",
"format": "int64",
"type": "integer"
},
"name": {
"description": "Name of this Tag",
"type": "string"
}
},
"type": "object"
}
},
"info": {
"description": "This is a simplified version of the sample server Petstore server.",
"title": "Swagger Petstore",
"version": "1.0.0"
},
"paths": {
"/pet/{petId}": {
"get": {
"description": "Returns a single pet",
"operationId": "getPetById",
"parameters": [
{
"description": "ID of pet to return",
"format": "int64",
"in": "path",
"name": "petId",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Pet"
}
}
},
"summary": "Find pet by ID"
}
}
},
"swagger": "2.0"
}
{"swagger":"2.0","info":{"description":"This is a simplified version of the sample server Petstore server.","version":"1.0.0","title":"Swagger Petstore"},"paths":{"/pet/{petId}":{"get":{"summary":"Find pet by ID","description":"Returns a single pet","operationId":"getPetById","parameters":[{"name":"petId","in":"path","description":"ID of pet to return","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Pet"}}}}}},"definitions":{"Category":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique ID of the Category"},"name":{"type":"string","description":"Name of this category"}},"description":"A Category used to group pets"},"Pet":{"type":"object","required":["name","photoUrls"],"properties":{"category":{"description":"Optional category of the pet","$ref":"#/definitions/Category"},"id":{"type":"integer","format":"int64","description":"Unique ID of this Pet"},"name":{"type":"string","description":"Name of this specific pet"},"photoUrls":{"type":"array","description":"Photo URls for this Pet on the bucket","items":{"type":"string"}},"tags":{"type":"array","description":"Pet status in the store","items":{"$ref":"#/definitions/Tag"}}},"description":"Represents a specific Pet in the store"},"Tag":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique ID of the Tag"},"name":{"type":"string","description":"Name of this Tag"}},"description":"A Tag used to group entities"}}}
Loading

0 comments on commit 4a9fbf9

Please sign in to comment.