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
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Eclipse
.classpath
.project
.settings/

# Intellij
.idea/
*.iml
*.iws

# VSCode
bin/

# Mac
.DS_Store

# Smithy
.smithy.lsp.log

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build/
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# InAndOut-API-Modelling
Module used to create clients (standard data types and classes) for our services and interfaces

Complete API model for our system.

References:

- https://docs.google.com/document/d/1HnRcB2SaG4f4QodOaaYZT4r4GYhibqBzA8wdl2zpID0/edit?tab=t.h8qwaqvashle
- https://openapi-converter.com/json-to-yaml
- https://editor.swagger.io/
- https://smithy.io/2.0/languages/java/client/generating-clients.html
- https://smithy.io/2.0/guides/using-code-generation/generating-a-client.html
42 changes: 42 additions & 0 deletions smithy-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "1.0",
"outputDirectory": "build/",
"sources": ["smithy/model/"],
"maven": {
"dependencies": [
"software.amazon.smithy:smithy-aws-traits:1.68.0",
"software.amazon.smithy:smithy-openapi:1.68.0",
"software.amazon.smithy:smithy-linters:1.68.0",
"software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.45.0",
"software.amazon.smithy.java:client-codegen:0.0.3",
"software.amazon.smithy.java:client-core:0.0.3"
]
},
"projections": {
"openapi-spec": {
"plugins": {
"openapi": {
"service": "com.shopping.inandout#InAndOut",
"protocol": "aws.protocols#restJson1",
"version": "3.1.0"
}
}
},
"java-client": {
"plugins": {
"java-client-codegen": {
"service": "com.shopping.inandout#InAndOut",
"namespace": "com.shopping.inandout"
}
}
},
"typescript-client": {
"plugins": {
"typescript-codegen": {
"package": "@inandout/client",
"packageVersion": "0.0.1"
}
}
}
}
}
11 changes: 11 additions & 0 deletions smithy/model/common.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$version: "2"

namespace com.shopping.inandout

@pattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
@length(min: 36, max: 36)
string UUID

list UUIDList {
member: UUID
}
38 changes: 38 additions & 0 deletions smithy/model/errors.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
$version: "2"

namespace com.shopping.inandout

@error("client")
@httpError(400)
structure InvalidInputError {
@required
message: String
}

@error("client")
@httpError(404)
structure ResourceNotFoundError {
@required
message: String
}

@error("client")
@httpError(409)
structure ResourceAlreadyExistsError {
@required
message: String
}

@error("client")
@httpError(409)
structure DeleteRestrictedError {
@required
message: String
}

@error("server")
@httpError(500)
structure InternalServerError {
@required
message: String
}
14 changes: 14 additions & 0 deletions smithy/model/main.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$version: "2"

namespace com.shopping.inandout

use com.shopping.inandout.tsp#FindTspSolution
use aws.protocols#restJson1

@restJson1
service InAndOut {
version: "2026-04-01"
operations: [
FindTspSolution
]
}
19 changes: 19 additions & 0 deletions smithy/model/tsp/tsp-apis.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$version: "2"

namespace com.shopping.inandout.tsp

use com.shopping.inandout#InternalServerError
use com.shopping.inandout#InvalidInputError
use com.shopping.inandout#ResourceNotFoundError

@http(method: "POST", uri: "/tsp")
@documentation("Travelling salesman problem solution creation/retrieval operation")
operation FindTspSolution {
input: FindTspSolutionInput
output: FindTspSolutionOutput
errors: [
InvalidInputError
ResourceNotFoundError
InternalServerError
]
}
15 changes: 15 additions & 0 deletions smithy/model/tsp/tsp-io.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$version: "2"

namespace com.shopping.inandout.tsp

use com.shopping.inandout#UUIDList

structure FindTspSolutionInput {
@required
standIdList: UUIDList
}

structure FindTspSolutionOutput {
@required
solutionList: SolutionList
}
16 changes: 16 additions & 0 deletions smithy/model/tsp/tsp-types.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$version: "2"

namespace com.shopping.inandout.tsp

use com.shopping.inandout#UUIDList

@documentation("Optimal market route")
structure Solution {
@required
@documentation("Ordered location list of the selected articles")
nodeIdList: UUIDList
}

list SolutionList {
member: Solution
}