Skip to content

Commit

Permalink
Map typealias for JSON schema codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
gino-m committed Jan 23, 2024
1 parent 2182b2b commit c85786d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
1 change: 0 additions & 1 deletion shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ buildscript {
apply<JSONSchemaCodegenPlugin>()

configure<JSONSchemaCodegen> {
packageName.set("com.google.ground.shared.schema")
// These must be specified since plugins defaults are relative to project root.
configFile.set(file("src/main/resources/schema/config.json")) // if not in the default location
inputs { inputFile(file("src/main/resources/schema")) }
Expand Down
19 changes: 19 additions & 0 deletions shared/src/main/kotlin/com/google/ground/shared/schema/Map.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.ground.shared.schema

typealias Map = kotlin.collections.Map<String, Any>
2 changes: 1 addition & 1 deletion shared/src/main/resources/schema/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"customClasses": {
"extension": {
"x-local-type": {
"map": "kotlin.collections.Map<String, Any>"
"map": "com.google.ground.shared.schema.Map"
}
}
}
Expand Down

0 comments on commit c85786d

Please sign in to comment.