Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5b3a93f
Update codegen for API 26.6
TimurBaiguskarovAspose Jun 10, 2026
b2597a7
Fix Java wrapper import template
TimurBaiguskarovAspose Jun 11, 2026
a97ef84
Split generate params into groups
Denis-Averin Jun 22, 2026
dba0919
Refresh the spec from the live API and drop inject-param-groups
Denis-Averin Jul 2, 2026
3a90e61
Honor configured request timeout on Linux in Swift URLSession template
Denis-Averin Jul 7, 2026
1f2c082
Bump all SDKs to 26.7 and stabilize config-*.json serialization
Denis-Averin Jul 16, 2026
a770213
Drop unused generator scaffolding from the generated SDKs
Denis-Averin Jul 16, 2026
8f5a87f
Sync Java and Node template dependency versions with the shipped SDKs
Denis-Averin Jul 16, 2026
901cc7a
Preserve the \Throwable date-parse catch in the PHP ObjectSerializer …
Denis-Averin Jul 16, 2026
e306e65
Update Swift README integration-test credential instructions
Denis-Averin Jul 16, 2026
f9919be
Add repository requirements and process documentation under doc/
Denis-Averin Jul 16, 2026
d1d96ff
Remove the obsolete v1/v1.1/v2/v3 API-version references
Denis-Averin Jul 16, 2026
d85901a
Update merged submodules
Denis-Averin Jul 16, 2026
97ada1c
Update Swift templates
Denis-Averin Jul 16, 2026
e47fde1
Fix Swift templates
Denis-Averin Jul 17, 2026
5edb65d
ignore "example" domains
Denis-Averin Jul 17, 2026
d143f46
Update Android templates
Denis-Averin Jul 27, 2026
3c923b2
Finalize release 26.7.0
TimurBaiguskarovAspose Jul 28, 2026
fc0145f
Update PHP submodule
TimurBaiguskarovAspose Jul 28, 2026
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
18 changes: 18 additions & 0 deletions Agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This is repository with swagger generated SDK for Aspose.Barcode.Cloud service and code generating scripts. All sdk are submodules of this repo and located in `submodules` directory. Swagger specification of service API is located in `spec/aspose-barcode-cloud.json` file. Custom mustashe templates are located in `codegen/Templates` dir. Original templates for all languages are in <https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/> github. Sripts for generating SDK `codegen` directory. Some post processing are in Makefiles in all submodules repo.

## SDK repository branches

Each SDK submodule is a standalone GitHub repo with its own default branch — `main` for all SDKs
**except `go`, whose default is `v4`**. Release work ships on a `release-<version>` branch as a draft
pull request into that default branch. See [`doc/branches.md`](doc/branches.md) for the full per-SDK
repository/branch table and details.

## Common requirements for making changes in SDK code

0. Don't commit or push in repo by youreself. But you can pull and stage in git.
Expand All @@ -14,3 +21,14 @@ This is repository with swagger generated SDK for Aspose.Barcode.Cloud service a
4.3 After generating script are end it work. Enshure there is no unstaged changes in sdk submodule.
4.4 Fix templates if generated code are not the same as you new code.
5. After templates fixed, you can end your task.

## Scripting requirements

- Never use Perl — neither standalone Perl scripts nor inline one-liners (e.g. `perl -pe` in shell scripts or Makefiles). Use Python instead.

## Test coverage requirements

Every generated SDK must satisfy two coverage bars — **API endpoint coverage ≥ 80%** and **line code
coverage ≥ 80%** (the latter enforced by a per-SDK CI gate). `submodules/android` is exempt (it is a demo
app, not an SDK). Regenerating or changing an SDK must not drop either metric below 80%. See
[`doc/test-coverage-requirements.md`](doc/test-coverage-requirements.md) for the full requirements.
121 changes: 102 additions & 19 deletions codegen/Templates/android/MainActivity.kt.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,37 @@ import com.aspose.barcode.cloud.api.GenerateApi
import com.aspose.barcode.cloud.api.ScanApi
import com.aspose.barcode.cloud.model.BarcodeImageFormat
import com.aspose.barcode.cloud.model.BarcodeImageParams
import com.aspose.barcode.cloud.model.Code128EncodeMode
import com.aspose.barcode.cloud.model.Code128Params
import com.aspose.barcode.cloud.model.ECIEncodings
import com.aspose.barcode.cloud.model.EncodeBarcodeType
import com.aspose.barcode.cloud.model.MicroQRVersion
import com.aspose.barcode.cloud.model.Pdf417EncodeMode
import com.aspose.barcode.cloud.model.Pdf417ErrorLevel
import com.aspose.barcode.cloud.model.Pdf417Params
import com.aspose.barcode.cloud.model.QREncodeMode
import com.aspose.barcode.cloud.model.QRErrorLevel
import com.aspose.barcode.cloud.model.QRVersion
import com.aspose.barcode.cloud.model.QrParams
import com.aspose.barcode.cloud.model.RectMicroQRVersion
import com.aspose.barcode.cloud.requests.GenerateRequestWrapper
import com.aspose.barcode.cloud.requests.ScanMultipartRequestWrapper
import com.google.android.material.snackbar.Snackbar
import java.io.File
import java.io.FileOutputStream
import kotlin.math.floor
import kotlin.math.min
import androidx.core.graphics.scale

class MainActivity : AppCompatActivity() {
companion object {
/** Barcode types whose modules are square and get distorted by a non-square image. */
private val SQUARE_BARCODE_TYPES = setOf(
EncodeBarcodeType.QR,
EncodeBarcodeType.GS1_QR,
EncodeBarcodeType.MICRO_QR,
)

private fun imageSize(width: Int, height: Int, maxSize: Int = 384): Size {
val ratio = width.toFloat() / height
if (ratio > 1) {
Expand Down Expand Up @@ -170,7 +186,7 @@ class MainActivity : AppCompatActivity() {
val smallerBmp = reduceBitmapSize(image)

barcodeImgView.setImageBitmap(smallerBmp)
startRecognizeAnimation()
startProgressAnimation()

val tmpFile = File.createTempFile("barcode", null)

Expand All @@ -185,7 +201,7 @@ class MainActivity : AppCompatActivity() {
val recognized = scanApi.scanMultipart(apiRequest)

runOnUiThread {
stopRecognizeAnimation()
stopProgressAnimation()
if (recognized.barcodes.isEmpty()) {
barcodeTextEdit.setText("")
showErrorMessage("No barcode detected")
Expand All @@ -198,7 +214,7 @@ class MainActivity : AppCompatActivity() {
}
} catch (e: ApiException) {
runOnUiThread {
stopRecognizeAnimation()
stopProgressAnimation()

var message = e.message + ": " + e.details
if (e.httpCode == 0) {
Expand All @@ -208,7 +224,7 @@ class MainActivity : AppCompatActivity() {
}
} catch (e: Exception) {
runOnUiThread {
stopRecognizeAnimation()
stopProgressAnimation()
showErrorMessage("Exception: " + e.message)
}
}
Expand All @@ -218,44 +234,38 @@ class MainActivity : AppCompatActivity() {
}
}

private fun startRecognizeAnimation() {
private fun startProgressAnimation() {
val rotation = AnimationUtils.loadAnimation(this, R.anim.rotate)
rotation.fillAfter = true
barcodeImgView.startAnimation(rotation)
}

private fun stopRecognizeAnimation() {
private fun stopProgressAnimation() {
barcodeImgView.clearAnimation()
}

fun onBtnGenerateClick(@Suppress("UNUSED_PARAMETER") view: View) {
val type = EncodeBarcodeType.fromValue(barcodeTypeSpinner.selectedItem.toString())

val genRequest = GenerateRequestWrapper(type, barcodeTextEdit.text.toString())
genRequest.barcodeImageParams = BarcodeImageParams().apply {
imageFormat = BarcodeImageFormat.PNG
imageHeight = barcodeImgView.measuredHeight.toFloat()
imageWidth = barcodeImgView.measuredWidth.toFloat()
}
genRequest.barcodeImageParams = imageParams(type)

if (type == EncodeBarcodeType.QR) {
genRequest.qrParams = QrParams().apply {
qrEncodeMode = QREncodeMode.AUTO
qrErrorLevel = QRErrorLevel.LEVEL_M
qrVersion = QRVersion.AUTO
qrAspectRatio = 0.75f
}
}
applyEncodeParams(genRequest, type)

startProgressAnimation()

Thread {
try {
val generated = generateApi.generate(genRequest)
runOnUiThread {
stopProgressAnimation()
val bitmap = BitmapFactory.decodeFile(generated!!.absolutePath)
barcodeImgView.setImageBitmap(bitmap)
}
} catch (e: ApiException) {
runOnUiThread {
stopProgressAnimation()

var message = e.message + ": " + e.details
if (e.httpCode == 0) {
message = "Check ClientId and ClientSecret in ApiClient $message"
Expand All @@ -264,12 +274,85 @@ class MainActivity : AppCompatActivity() {
}
} catch (e: Exception) {
runOnUiThread {
stopProgressAnimation()
showErrorMessage("Exception: " + e.message)
}
}
}.start()
}

/**
* The API stretches the barcode to fill the requested image, so a square symbology
* has to be rendered into a square image to keep its modules square.
*/
private fun imageParams(type: EncodeBarcodeType) = BarcodeImageParams().apply {
imageFormat = BarcodeImageFormat.PNG

if (type in SQUARE_BARCODE_TYPES) {
val side = min(barcodeImgView.measuredWidth, barcodeImgView.measuredHeight).toFloat()
imageHeight = side
imageWidth = side
} else {
imageHeight = barcodeImgView.measuredHeight.toFloat()
imageWidth = barcodeImgView.measuredWidth.toFloat()
}
}

/**
* Attaches the optional parameter groups supported by [GenerateRequestWrapper].
* Each group applies to its own family of barcode types.
*/
private fun applyEncodeParams(request: GenerateRequestWrapper, type: EncodeBarcodeType) {
when (type) {
EncodeBarcodeType.QR,
EncodeBarcodeType.GS1_QR -> request.qrParams = qrParams()

EncodeBarcodeType.MICRO_QR -> request.qrParams = qrParams().apply {
microQRVersion = MicroQRVersion.AUTO
}

EncodeBarcodeType.RECT_MICRO_QR -> request.qrParams = qrParams().apply {
rectMicroQrVersion = RectMicroQRVersion.AUTO
}

EncodeBarcodeType.CODE128,
EncodeBarcodeType.GS1_CODE128 -> request.code128Params = Code128Params().apply {
code128EncodeMode = Code128EncodeMode.AUTO
}

EncodeBarcodeType.PDF417,
EncodeBarcodeType.MACRO_PDF417 -> request.pdf417Params = pdf417Params(3.0f)

EncodeBarcodeType.MICRO_PDF417,
EncodeBarcodeType.GS1_MICRO_PDF417 -> request.pdf417Params = pdf417Params(2.0f)

else -> Unit
}
}

private fun qrParams() = QrParams().apply {
qrEncodeMode = QREncodeMode.AUTO
qrErrorLevel = QRErrorLevel.LEVEL_M
qrVersion = QRVersion.AUTO
qrECIEncoding = ECIEncodings.UTF8
// 1.0 keeps the modules square, lower values flatten the barcode.
qrAspectRatio = 1.0f
}

/**
* @param aspectRatio defined by the standard: 3 to 5 for Pdf417 and MacroPdf417,
* 2 to 5 for MicroPdf417.
*/
private fun pdf417Params(aspectRatio: Float) = Pdf417Params().apply {
pdf417EncodeMode = Pdf417EncodeMode.AUTO
pdf417ErrorLevel = Pdf417ErrorLevel.LEVEL2
pdf417ECIEncoding = ECIEncodings.UTF8
pdf417AspectRatio = aspectRatio
// 0 selects the column and row count automatically.
pdf417Columns = 0
pdf417Rows = 0
}

fun onBtnTakePhotoClick(@Suppress("UNUSED_PARAMETER") view: View) {
val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
if (takePictureIntent.resolveActivity(packageManager) != null) {
Expand Down
4 changes: 2 additions & 2 deletions codegen/Templates/android/build.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '9.1.0' apply false
id 'com.android.library' version '9.1.0' apply false
id 'com.android.application' version '9.3.1' apply false
id 'com.android.library' version '9.3.1' apply false
}
3 changes: 3 additions & 0 deletions codegen/Templates/android/gitignore.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ out/
.gradle/
build/

# Daemon JVM criteria, generated locally by the updateDaemonJvm task
gradle/gradle-daemon-jvm.properties

# Local configuration file (sdk path, etc)
local.properties

Expand Down
1 change: 1 addition & 0 deletions codegen/Templates/android/manifest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_descriptor"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
61 changes: 0 additions & 61 deletions codegen/Templates/csharp/AbstractOpenAPISchema.mustache

This file was deleted.

6 changes: 0 additions & 6 deletions codegen/Templates/go/configuration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ type BasicAuth struct {
Password string `json:"password,omitempty"`
}

// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIKey struct {
Key string
Prefix string
}

// Configuration - API configuration
type Configuration struct {
BasePath string `json:"basePath,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions codegen/Templates/java/pom.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<gson-version>2.14.0</gson-version>
<okhttp-version>5.3.2</okhttp-version>
<okhttp-version>5.4.0</okhttp-version>
{{#joda}}
<jodatime-version>2.9.9</jodatime-version>
{{/joda}}
Expand All @@ -284,7 +284,7 @@
{{/threetenbp}}
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.2</junit-version>
<jacoco.version>0.8.14</jacoco.version>
<jacoco.version>0.8.15</jacoco.version>
<versions-maven-plugin.version>2.21.0</versions-maven-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down
6 changes: 3 additions & 3 deletions codegen/Templates/nodejs/package.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@
"@typescript-eslint/parser": "^8.40.0",
"eslint": "^9.33.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-prettier": "^5.5.6",
"npm-check-updates": "^17.1.18",
"prettier": "^3.8.3",
"ts-jest": "^29.4.9",
"prettier": "^3.9.5",
"ts-jest": "^29.4.11",
"tslib": "^2.8.1",
"tsup": "^8.5.1"
},
Expand Down
4 changes: 2 additions & 2 deletions codegen/Templates/php/Configuration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class Configuration implements JsonSerializable
protected $authUrl = '{{#authMethods}}{{#-first}}{{tokenUrl}}{{/-first}}{{/authMethods}}';

/**
* Version of API to use, possible values are v1, v1.1, v2, v3
* default value is v1
* Versioned base path of the API (e.g. /v4.0)
*
* @var string
*/
protected $base_path = '{{basePathWithoutHost}}';
Expand Down
Loading