Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:Sphereon-Opensource/OpenID-Feder…
Browse files Browse the repository at this point in the history
…ation into feature/OIDF-42
  • Loading branch information
Zoe Maas committed Jul 23, 2024
2 parents 440300c + fc14070 commit bfb9cd9
Show file tree
Hide file tree
Showing 11 changed files with 1,699 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ kotlin = "2.0.0"
kotlinxSerializationJson = "1.7.0-RC"
springboot = "3.3.1"
springDependencyManagement = "1.1.5"
kermitLogging = "2.0.4"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
Expand All @@ -29,6 +30,7 @@ androidx-material = { group = "com.google.android.material", name = "material",
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
kermit-logging = { module = "co.touchlab:kermit", version.ref = "kermitLogging"}

kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect" }
springboot-actuator = { group = "org.springframework.boot", name = "spring-boot-starter-actuator" }
Expand Down
3 changes: 2 additions & 1 deletion modules/admin-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "com.sphereon.oid.fed.server.admin"
version = "1.0.0"
version = "0.0.1"

java {
toolchain {
Expand All @@ -16,6 +16,7 @@ java {
}

dependencies {
api(projects.modules.openidFederationCommon)
implementation(libs.springboot.actuator)
implementation(libs.springboot.web)
implementation(libs.springboot.data.jdbc)
Expand Down
33 changes: 33 additions & 0 deletions modules/openapi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Open API specs

The Open API specs of OpenID Federation.

## Entity Statement

An Entity Statement contains the information needed for the Entity that is the subject of the Entity Statement to
participate in federation(s). An Entity Statement is a signed JWT. The subject of the JWT is the Entity itself. The
issuer of the JWT is the party that issued the Entity Statement. All Entities in a federation publish an Entity Statement
about themselves called an Entity Configuration. Superior Entities in a federation publish Entity Statements about their
Immediate Subordinate Entities called Subordinate Statements.

### Profiles

The Open API generator will generate models, infrastructures and apis by default. To make
it generate models only uncomment `profiles=models-only` from gradle.properties or pass the profile in the comment line.

### Run Open API generator

Generate models, infrastructures and apis:
```shell
gradle clean openApiGenerate
```

Generate only models:
```shell
gradle clean openApiGenerate -Pprofile=model-only
```

Generate the jar file:
```shell
gradle clean build
```
82 changes: 82 additions & 0 deletions modules/openapi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
plugins {
kotlin("jvm") version "2.0.0"
id("org.openapi.generator") version "7.7.0"
id("maven-publish")
}

group = "com.sphereon.oid.fed"
version = "0.1.0-SNAPSHOT"

project.extra.set("openApiPackage", "com.sphereon.oid.fed.openapi")

val profiles = project.properties["profiles"]?.toString()?.split(",") ?: emptyList()
val isModelsOnlyProfile = profiles.contains("models-only")
val ktorVersion = "2.3.11"

repositories {
mavenCentral()
}

dependencies {
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.0")
}

openApiGenerate {
val openApiPackage: String by project
generatorName.set("kotlin")
packageName.set("com.sphereon.oid.fed.openapi")
apiPackage.set("$openApiPackage.api")
modelPackage.set("$openApiPackage.models")
inputSpec.set("$projectDir/src/main/kotlin/com/sphereon/oid/fed/openapi/openapi.yaml")
library.set("multiplatform")
outputDir.set("$projectDir/build/generated")
configOptions.set(
mapOf(
"dateLibrary" to "string"
)
)

if (isModelsOnlyProfile) {
globalProperties.set(
configOptions.get().plus(
mapOf(
"models" to ""
)
)
)
}
}


publishing {
publications {
create<MavenPublication>("mavenKotlin") {
from(components["kotlin"])
}
}
}

tasks.compileKotlin {
dependsOn(tasks.openApiGenerate)
}

tasks.jar {
dependsOn(tasks.compileKotlin)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveBaseName.set(project.name)
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
from("$projectDir/build/classes/kotlin/main")
}

kotlin {
sourceSets.main {
kotlin.srcDirs(
"$projectDir/build/generated/src/commonMain/kotlin"
)
}
jvmToolchain(21)
}
2 changes: 2 additions & 0 deletions modules/openapi/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kotlin.code.style=official
#profiles=models-only
4 changes: 4 additions & 0 deletions modules/openapi/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
rootProject.name = "openapi"
Loading

0 comments on commit bfb9cd9

Please sign in to comment.