Skip to content

Commit 81d3b5b

Browse files
oyvindbergclaude
andcommitted
Add unified shared types across databases and OpenAPI sources
- Add SourceKind ADT to distinguish Database vs OpenAPI sources - Add ApiFieldKind to track model properties vs API parameters - Generate shared types with proper documentation showing all aligned sources - Support TypeDefinitions matching across PostgreSQL, MariaDB, and OpenAPI - Add fieldTypeOverrides for explicit field→type mappings in OpenAPI - Include detailed location paths (e.g., Customer.firstName, /customers.isActive) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 74aab05 commit 81d3b5b

1,944 files changed

Lines changed: 32878 additions & 7977 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bleep.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,31 @@ projects:
283283
folder: ./testers/openapi/scala/spring
284284
isTestProject: true
285285
sources: ./testapi
286+
testers/combined/java:
287+
dependencies:
288+
- com.fasterxml.jackson.core:jackson-annotations:2.17.2
289+
- com.fasterxml.jackson.core:jackson-databind:2.17.2
290+
- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2
291+
- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2
292+
- com.novocode:junit-interface:0.11
293+
- io.smallrye.reactive:mutiny:2.6.1
294+
- io.smallrye.reactive:mutiny-zero-flow-adapters:1.0.0
295+
- jakarta.validation:jakarta.validation-api:3.0.2
296+
- jakarta.ws.rs:jakarta.ws.rs-api:3.1.0
297+
- junit:junit:4.13.2
298+
- org.mariadb.jdbc:mariadb-java-client:3.5.0
299+
- org.postgresql:postgresql:42.7.3
300+
dependsOn: foundations-jdbc-dsl
301+
isTestProject: true
302+
java:
303+
options: -proc:none
304+
platform:
305+
name: jvm
306+
sources:
307+
- ./generated-and-checked-in/shared
308+
- ./generated-and-checked-in/postgres
309+
- ./generated-and-checked-in/mariadb
310+
- ./generated-and-checked-in/api
286311
testers/oracle/java:
287312
dependencies:
288313
- com.fasterxml.jackson.core:jackson-annotations:2.17.2
@@ -543,6 +568,9 @@ scripts:
543568
main: scripts.GeneratedMariaDb
544569
project: typr-scripts
545570
sourceGlobs: ../mariadb_sql
571+
generate-combined-test:
572+
main: scripts.GenerateCombinedTest
573+
project: typr-scripts
546574
generate-openapi-test:
547575
main: scripts.GenerateOpenApiTest
548576
project: typr-scripts

site/package-lock.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/showcase-generated

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../showcase-generated
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
select personperson0."businessentityid", personperson0."persontype", personperson0."namestyle", personperson0."title", personperson0."firstname", personperson0."middlename", personperson0."lastname", personperson0."suffix", personperson0."emailpromotion", personperson0."additionalcontactinfo", personperson0."demographics", personperson0."rowguid", personperson0."modifieddate"
2-
from (select * from "person"."person" personperson0 where ((((personperson0)."persontype" = ?::bpchar) AND ((personperson0)."firstname" = ?)) AND ((personperson0)."lastname" = ?::"public"."Name"))) personperson0
2+
from (select * from "person"."person" personperson0 where ((((personperson0)."persontype" = ?::bpchar) AND ((personperson0)."firstname" = ?::"public"."Name")) AND ((personperson0)."lastname" = ?::"public"."Name"))) personperson0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* File has been automatically generated by `typo`.
3+
*
4+
* <p>IF YOU CHANGE THIS FILE YOUR CHANGES WILL BE OVERWRITTEN.
5+
*/
6+
package combined.api.api;
7+
8+
import combined.api.model.Customer;
9+
import combined.api.model.CustomerCreate;
10+
import combined.api.model.CustomerUpdate;
11+
import io.smallrye.mutiny.Uni;
12+
import java.util.List;
13+
import java.util.Optional;
14+
15+
public interface CustomersApi {
16+
/** Create a new customer */
17+
Uni<Customer> createCustomer(CustomerCreate body);
18+
19+
/** Get customer by ID */
20+
Uni<Customer> getCustomer(Long customerId);
21+
22+
/** List all customers */
23+
Uni<List<Customer>> listCustomers(
24+
25+
/** Filter by active status */
26+
Optional<Boolean> isActive);
27+
28+
/** Update customer */
29+
Uni<Customer> updateCustomer(Long customerId, CustomerUpdate body);
30+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* File has been automatically generated by `typo`.
3+
*
4+
* <p>IF YOU CHANGE THIS FILE YOUR CHANGES WILL BE OVERWRITTEN.
5+
*/
6+
package combined.api.api;
7+
8+
import combined.api.model.Customer;
9+
import combined.api.model.CustomerCreate;
10+
import combined.api.model.CustomerUpdate;
11+
import io.smallrye.mutiny.Uni;
12+
import jakarta.ws.rs.Consumes;
13+
import jakarta.ws.rs.GET;
14+
import jakarta.ws.rs.POST;
15+
import jakarta.ws.rs.PUT;
16+
import jakarta.ws.rs.Path;
17+
import jakarta.ws.rs.PathParam;
18+
import jakarta.ws.rs.Produces;
19+
import jakarta.ws.rs.QueryParam;
20+
import jakarta.ws.rs.core.MediaType;
21+
import java.util.List;
22+
import java.util.Optional;
23+
24+
@Path("/customers")
25+
public interface CustomersApiServer extends CustomersApi {
26+
/** Create a new customer */
27+
@Override
28+
@POST
29+
@Path("")
30+
@Consumes(value = {MediaType.APPLICATION_JSON})
31+
@Produces(value = {MediaType.APPLICATION_JSON})
32+
Uni<Customer> createCustomer(CustomerCreate body);
33+
34+
/** Get customer by ID */
35+
@Override
36+
@GET
37+
@Path("/{customerId}")
38+
@Produces(value = {MediaType.APPLICATION_JSON})
39+
Uni<Customer> getCustomer(@PathParam("customerId") Long customerId);
40+
41+
/** List all customers */
42+
@Override
43+
@GET
44+
@Path("")
45+
@Produces(value = {MediaType.APPLICATION_JSON})
46+
Uni<List<Customer>> listCustomers(
47+
48+
/** Filter by active status */
49+
@QueryParam("isActive") Optional<Boolean> isActive);
50+
51+
/** Update customer */
52+
@Override
53+
@PUT
54+
@Path("/{customerId}")
55+
@Consumes(value = {MediaType.APPLICATION_JSON})
56+
@Produces(value = {MediaType.APPLICATION_JSON})
57+
Uni<Customer> updateCustomer(@PathParam("customerId") Long customerId, CustomerUpdate body);
58+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* File has been automatically generated by `typo`.
3+
*
4+
* <p>IF YOU CHANGE THIS FILE YOUR CHANGES WILL BE OVERWRITTEN.
5+
*/
6+
package combined.api.api;
7+
8+
import combined.api.model.Employee;
9+
import io.smallrye.mutiny.Uni;
10+
import java.util.List;
11+
import java.util.Optional;
12+
13+
public interface EmployeesApi {
14+
/** Get employee by ID */
15+
Uni<Employee> getEmployee(Integer employeeId);
16+
17+
/** List all employees */
18+
Uni<List<Employee>> listEmployees(
19+
20+
/** Filter by active status */
21+
Optional<Boolean> isActive);
22+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* File has been automatically generated by `typo`.
3+
*
4+
* <p>IF YOU CHANGE THIS FILE YOUR CHANGES WILL BE OVERWRITTEN.
5+
*/
6+
package combined.api.api;
7+
8+
import combined.api.model.Employee;
9+
import io.smallrye.mutiny.Uni;
10+
import jakarta.ws.rs.GET;
11+
import jakarta.ws.rs.Path;
12+
import jakarta.ws.rs.PathParam;
13+
import jakarta.ws.rs.Produces;
14+
import jakarta.ws.rs.QueryParam;
15+
import jakarta.ws.rs.core.MediaType;
16+
import java.util.List;
17+
import java.util.Optional;
18+
19+
@Path("/employees")
20+
public interface EmployeesApiServer extends EmployeesApi {
21+
/** Get employee by ID */
22+
@Override
23+
@GET
24+
@Path("/{employeeId}")
25+
@Produces(value = {MediaType.APPLICATION_JSON})
26+
Uni<Employee> getEmployee(@PathParam("employeeId") Integer employeeId);
27+
28+
/** List all employees */
29+
@Override
30+
@GET
31+
@Path("")
32+
@Produces(value = {MediaType.APPLICATION_JSON})
33+
Uni<List<Employee>> listEmployees(
34+
35+
/** Filter by active status */
36+
@QueryParam("isActive") Optional<Boolean> isActive);
37+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* File has been automatically generated by `typo`.
3+
*
4+
* <p>IF YOU CHANGE THIS FILE YOUR CHANGES WILL BE OVERWRITTEN.
5+
*/
6+
package combined.api.api;
7+
8+
import combined.api.model.Product;
9+
import io.smallrye.mutiny.Uni;
10+
import java.util.List;
11+
import java.util.Optional;
12+
13+
public interface ProductsApi {
14+
/** List all products from both databases */
15+
Uni<List<Product>> listProducts(
16+
/** Filter by data source */
17+
Optional<String> source,
18+
/** Filter by active status */
19+
Optional<Boolean> isActive);
20+
}

0 commit comments

Comments
 (0)