Skip to content

feat: new sdk core #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# Configuration file for EditorConfig: http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

# space indentation for JSON and YML
[*.{json,json5,yml,yaml}]
indent_size = 2

[*.kt]
ktlint_standard_enum-entry-name-case = disabled
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.gradle
.idea

build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Kotlin ###
.kotlin

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
13 changes: 13 additions & 0 deletions LICENSE-HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (C) 2025 Expedia, Inc.

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

http://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.
88 changes: 88 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.Duration

plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "2.1.10"
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}

group = project.property("GROUP_ID") as String

apply("$rootDir/gradle-tasks/specs.gradle.kts")
apply("$rootDir/gradle-tasks/snapshot.gradle")

allprojects {
repositories {
mavenCentral()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
}
}
}

subprojects {
apply(plugin = "java")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jlleitschuh.gradle.ktlint")

plugins.withId("org.jetbrains.kotlin.jvm") {
kotlin {
jvmToolchain(8)
}
}

plugins.withType<KotlinBasePluginWrapper>().configureEach {
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
}

java {
withSourcesJar()
withJavadocJar()

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

// Gradle 7+ Java toolchain approach (also sets 1.8)
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

ktlint {
debug.set(true)
version.set("1.5.0")
verbose.set(true)

additionalEditorconfig.set(
mapOf(
"max_line_length" to "200",
"indent_style" to "space",
"indent_size" to "4",
"insert_final_newline" to "true",
"end_of_line" to "lf",
),
)
}
}

nexusPublishing {
repositories {
sonatype {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}

transitionCheckOptions {
maxRetries.set(60)
delayBetween.set(Duration.ofMillis(5000))
}
}
12 changes: 12 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

dependencies {
api("org.openapitools:openapi-generator:7.11.0")
implementation("com.samskivert:jmustache:1.15")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.expediagroup.sdk.xap.generator.mustache

import com.samskivert.mustache.Mustache
import com.samskivert.mustache.Template
import java.io.Serializable
import java.io.Writer
import org.openapitools.codegen.CodegenResponse

class AllowedMediaTypesLambda : Mustache.Lambda, Serializable {
override fun execute(
fragment: Template.Fragment,
writer: Writer,
) {
val response: CodegenResponse = fragment.context() as CodegenResponse
if (response.is2xx) {
val mediaTypes: List<String> =
response.content.keys.filter {
!it.contains("xml", ignoreCase = true)
}

val context = mapOf("mediaTypes" to mediaTypes)
fragment.execute(context, writer)
}
}
}
Loading