Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/samples-scala-jdk8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Samples Scala/sbt (JDK8)

on:
push:
paths:
- 'samples/server/petstore/scala-finch/**'
pull_request:
paths:
- 'samples/server/petstore/scala-finch/**'
jobs:
build:
name: Build scala-finch servers
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# servers
- samples/server/petstore/scala-finch # cannot be tested with jdk11
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
path: |
~/.ivy2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/build.sbt') }}
- name: Build and test
working-directory: ${{ matrix.sample }}
run: sbt -v +test
8 changes: 4 additions & 4 deletions .github/workflows/samples-scala.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ jobs:
matrix:
sample:
# clients
- 'samples/client/petstore/java/okhttp-gson'
- samples/client/petstore/java/okhttp-gson
- samples/client/petstore/scalaz
- samples/client/petstore/scala-pekko
- samples/client/petstore/scala-http4s
#- samples/client/petstore/scala-sttp # won't pass while the same tests in circleci pass
#- samples/client/petstore/scala-sttp
#- samples/client/petstore/scala-sttp-circe
# servers
- samples/server/petstore/scala-lagom-server
- samples/server/petstore/scala-play-server
- samples/server/petstore/scala-akka-http-server
- samples/server/petstore/scala-pekko-http-server
- samples/server/petstore/scalatra
- samples/server/petstore/scala-finch # cannot be tested with jdk11
- samples/server/petstore/scala-http4s-server
- samples/server/petstore/scala-cask
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
java-version: 11
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Cache maven dependencies
Expand Down
1 change: 1 addition & 0 deletions CI/circle_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ else

(cd samples/client/petstore/scala-akka && mvn integration-test)
(cd samples/client/petstore/scala-sttp && mvn integration-test)
(cd samples/client/petstore/scala-sttp-circe && mvn integration-test)
(cd samples/client/petstore/scala-sttp4 && mvn integration-test)
(cd samples/client/petstore/clojure && mvn integration-test)
(cd samples/client/petstore/java/jersey2-java8 && mvn integration-test)
Expand Down
15 changes: 15 additions & 0 deletions bin/configs/scala-sttp-circe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
generatorName: scala-sttp
outputDir: samples/client/petstore/scala-sttp-circe
inputSpec: modules/openapi-generator/src/test/resources/3_0/scala/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/scala-sttp
nameMappings:
_type: "`underscoreType`"
type_: "`typeWithUnderscore`"
http_debug_operation: "`httpDebugOperation`"
parameterNameMappings:
_type: underscoreType
type_: typeWithUnderscore
http_debug_operation: httpDebugOperation
additionalProperties:
artifactId: scala-sttp-petstore
jsonLibrary: circe
23 changes: 23 additions & 0 deletions samples/client/petstore/scala-sttp-circe/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
18 changes: 18 additions & 0 deletions samples/client/petstore/scala-sttp-circe/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
README.md
build.sbt
project/build.properties
src/main/scala/org/openapitools/client/api/FakeApi.scala
src/main/scala/org/openapitools/client/api/PetApi.scala
src/main/scala/org/openapitools/client/api/StoreApi.scala
src/main/scala/org/openapitools/client/api/UserApi.scala
src/main/scala/org/openapitools/client/core/AdditionalTypeSerializers.scala
src/main/scala/org/openapitools/client/core/DateSerializers.scala
src/main/scala/org/openapitools/client/core/JsonSupport.scala
src/main/scala/org/openapitools/client/model/ApiResponse.scala
src/main/scala/org/openapitools/client/model/Category.scala
src/main/scala/org/openapitools/client/model/EnumTest.scala
src/main/scala/org/openapitools/client/model/Order.scala
src/main/scala/org/openapitools/client/model/Pet.scala
src/main/scala/org/openapitools/client/model/PropertyNameMapping.scala
src/main/scala/org/openapitools/client/model/Tag.scala
src/main/scala/org/openapitools/client/model/User.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.13.0-SNAPSHOT
120 changes: 120 additions & 0 deletions samples/client/petstore/scala-sttp-circe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# scala-sttp-petstore

OpenAPI Petstore
- API version: 1.0.0
- Generator version: 7.13.0-SNAPSHOT

This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.


*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*

## Requirements

Building the API client library requires:
1. Java 1.7+
2. Maven/Gradle/SBT

## Installation

To install the API client library to your local Maven repository, simply execute:

```shell
mvn clean install
```

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

```shell
mvn clean deploy
```

Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.

### Maven users

Add this dependency to your project's POM:

```xml
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>scala-sttp-petstore</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
```

### Gradle users

Add this dependency to your project's build file:

```groovy
compile "org.openapitools:scala-sttp-petstore:1.0.0"
```

### SBT users

```scala
libraryDependencies += "org.openapitools" % "scala-sttp-petstore" % "1.0.0"
```

## Getting Started

## Documentation for API Endpoints

All URIs are relative to *http://petstore.swagger.io/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FakeApi* | **getParameterNameMapping** | **GET** /fake/parameter-name-mapping | parameter name mapping test
*PetApi* | **addPet** | **POST** /pet | Add a new pet to the store
*PetApi* | **deletePet** | **DELETE** /pet/${petId} | Deletes a pet
*PetApi* | **findPetsByStatus** | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | **findPetsByTags** | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | **getPetById** | **GET** /pet/${petId} | Find pet by ID
*PetApi* | **updatePet** | **PUT** /pet | Update an existing pet
*PetApi* | **updatePetWithForm** | **POST** /pet/${petId} | Updates a pet in the store with form data
*PetApi* | **uploadFile** | **POST** /pet/${petId}/uploadImage | uploads an image
*StoreApi* | **deleteOrder** | **DELETE** /store/order/${orderId} | Delete purchase order by ID
*StoreApi* | **getInventory** | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | **getOrderById** | **GET** /store/order/${orderId} | Find purchase order by ID
*StoreApi* | **placeOrder** | **POST** /store/order | Place an order for a pet
*UserApi* | **createUser** | **POST** /user | Create user
*UserApi* | **createUsersWithArrayInput** | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | **createUsersWithListInput** | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | **deleteUser** | **DELETE** /user/${username} | Delete user
*UserApi* | **getUserByName** | **GET** /user/${username} | Get user by user name
*UserApi* | **loginUser** | **GET** /user/login | Logs user into the system
*UserApi* | **logoutUser** | **GET** /user/logout | Logs out current logged in user session
*UserApi* | **updateUser** | **PUT** /user/${username} | Updated user


## Documentation for Models

- [ApiResponse](ApiResponse.md)
- [Category](Category.md)
- [EnumTest](EnumTest.md)
- [Order](Order.md)
- [Pet](Pet.md)
- [PropertyNameMapping](PropertyNameMapping.md)
- [Tag](Tag.md)
- [User](User.md)


<a id="documentation-for-authorization"></a>
## Documentation for Authorization


Authentication schemes defined for the API:
<a id="api_key"></a>
### api_key

- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header


## Author



18 changes: 18 additions & 0 deletions samples/client/petstore/scala-sttp-circe/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version := "1.0.0"
name := "scala-sttp-petstore"
organization := "org.openapitools"

scalaVersion := "2.13.16"
crossScalaVersions := Seq(scalaVersion.value, "2.12.20")

libraryDependencies ++= Seq(
"com.softwaremill.sttp.client3" %% "core" % "3.3.18",
"com.softwaremill.sttp.client3" %% "circe" % "3.3.18",
"io.circe" %% "circe-generic" % "0.14.1"
)

scalacOptions := Seq(
"-unchecked",
"-deprecation",
"-feature"
)
34 changes: 34 additions & 0 deletions samples/client/petstore/scala-sttp-circe/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>scala-sttp-circe-petstore</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>scala-sttp-circe-petstore</name>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>sbt-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>-ivy</argument>
<argument>${user.home}/.ivy2</argument>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.10.11
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api

import org.openapitools.client.core.JsonSupport._
import sttp.client3._
import sttp.model.Method

object FakeApi {
def apply(baseUrl: String = "http://petstore.swagger.io/v2") = new FakeApi(baseUrl)
}

class FakeApi(baseUrl: String) {

/**
* Expected answers:
* code 200 : (OK)
*
* @param underscoreType _type
* @param `type` type
* @param typeWithUnderscore type_
* @param httpDebugOption http debug option (to test parameter naming option)
*/
def getParameterNameMapping(underscoreType: Long, `type`: String, typeWithUnderscore: String, httpDebugOption: String
): Request[Either[ResponseException[String, Exception], Unit], Any] =
basicRequest
.method(Method.GET, uri"$baseUrl/fake/parameter-name-mapping?type=${ `type` }&http_debug_option=${ httpDebugOption }")
.contentType("application/json")
.header("_type", underscoreType.toString)
.header("type_", typeWithUnderscore.toString)
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))

}
Loading
Loading