Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Version 1.1.1. That corrects the Query param when is a List adds the …
Browse files Browse the repository at this point in the history
…type (#19)

* Version 1.1.1. That corrects the Query param when is a List adds the type

* Removed artifactory condition that is not needed now
  • Loading branch information
ferranpons committed Oct 31, 2018
1 parent 89abbd5 commit 34524d8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ install: true # if we don't skip install, ./gradlew assemble is invoked, but th

before_script:
- export PATH=$TRAVIS_BUILD_DIR/bin:$PATH # ensure our tools are prefered over included ones.
- export ARTIFACTORY_DEPLOY="true"

script:
- ./gradlew buildPlugin
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Query params not correctly added on the retrofit interface. Kotlin version 1.3.0.
Query params when is a List it does not add the type of list.
10 changes: 8 additions & 2 deletions src/main/kotlin/protein/kotlinbuilders/KotlinApiBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,16 @@ class KotlinApiBuilder(
methodParameters.add(pathParameterSpec)
}
"query" -> {
val queryParameterSpec =
ParameterSpec.builder(parameter.name, getKotlinClassTypeName((parameter as QueryParameter).type))
val queryParameterSpec: ParameterSpec = if ((parameter as QueryParameter).type == ARRAY_SWAGGER_TYPE) {
ParameterSpec.builder(
parameter.name, List::class.asClassName().parameterizedBy(getKotlinClassTypeName(parameter.items.type))
).addAnnotation(
AnnotationSpec.builder(Query::class).addMember("\"${parameter.name}\"").build()).build()
} else {
ParameterSpec.builder(parameter.name, getKotlinClassTypeName(parameter.type))
.addAnnotation(
AnnotationSpec.builder(Query::class).addMember("\"${parameter.name}\"").build()).build()
}
methodParameters.add(queryParameterSpec)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.schibsted.protein</id>
<name>Protein - Kotlin code generator for Retrofit2 and RxJava2 based on Swagger</name>
<version>1.1.0</version>
<version>1.1.1</version>
<vendor email="ferran.pons@schibsted.com" url="http://www.schibsted.es">Schibsted Spain</vendor>

<description><![CDATA[
Expand Down Expand Up @@ -42,7 +42,7 @@
]]></description>

<change-notes><![CDATA[
Query params not correctly added on the retrofit interface. Kotlin version 1.3.0.
Query params when is a List it does not add the type of list.
]]>
</change-notes>

Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/mocks/pet_store_code_generated_mocks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const val PET_STORE_INTERFACE_MOCK = "package com.mycompany.mylibrary\n" +
" fun addPet(@Body body: Pet): Completable\n" +
"\n" +
" @GET(\"/pet/findByStatus\")\n" +
" fun findPetsByStatus(@Query(\"status\") status: List): Single<List<Pet>>\n" +
" fun findPetsByStatus(@Query(\"status\") status: List<String>): Single<List<Pet>>\n" +
"\n" +
" @GET(\"/pet/findByTags\")\n" +
" fun findPetsByTags(@Query(\"tags\") tags: List): Single<List<Pet>>\n" +
" fun findPetsByTags(@Query(\"tags\") tags: List<String>): Single<List<Pet>>\n" +
"\n" +
" @GET(\"/pet/{petId}\")\n" +
" fun getPetById(@Path(\"petId\") petId: Int): Single<Pet>\n" +
Expand Down
2 changes: 1 addition & 1 deletion travis/createTweetAfterDeployOnTag.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if [ -n "$TRAVIS_TAG" ] && [["$ARTIFACTORY_DEPLOY"=="false"]]; then
if [ -n "$TRAVIS_TAG" ]; then
./gradlew createTweet
else
echo "Tweet not created"
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MAJOR=1
MINOR=1
PATCH=0
PATCH=1

0 comments on commit 34524d8

Please sign in to comment.