-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NAVAND-1714] Upgrade services-cli (#1583)
* handle string input: -j "example json file" * exit with code 1 when failed verification * exit also with code 1 on back conversion: -c * pretty print result: -p * updated tests
- Loading branch information
Showing
8 changed files
with
272 additions
and
38 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
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
28 changes: 26 additions & 2 deletions
28
services-cli/src/main/kotlin/com/mapbox/services/cli/validator/ValidatorResult.kt
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 |
---|---|---|
@@ -1,11 +1,35 @@ | ||
package com.mapbox.services.cli.validator | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import com.mapbox.geojson.internal.typeadapters.RuntimeTypeAdapterFactory | ||
|
||
data class ValidatorResult( | ||
val filename: String, | ||
val input: ValidatorInput, | ||
val success: Boolean, | ||
@SerializedName("converts_back") | ||
val convertsBack: Boolean, | ||
val throwable: Throwable? = null | ||
val error: String? = null | ||
) | ||
|
||
|
||
sealed class ValidatorInput { | ||
data class File(val name: String) : ValidatorInput() | ||
object Json : ValidatorInput() | ||
|
||
companion object { | ||
fun gsonAdapter(): RuntimeTypeAdapterFactory<ValidatorInput> { | ||
return RuntimeTypeAdapterFactory | ||
.of<ValidatorInput>(ValidatorInput::class.java, "type") | ||
.registerSubtype( | ||
File::class.java, | ||
File::class.simpleName | ||
) | ||
.registerSubtype( | ||
Json::class.java, | ||
Json::class.simpleName | ||
) | ||
} | ||
} | ||
} | ||
|
||
|
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
Oops, something went wrong.