Skip to content

Add strong OpenAPI schema tooling - #182

Merged
eviltester merged 1 commit into
masterfrom
codex/openapi-strong-schema-tooling
Sep 16, 2026
Merged

eviltester merged 1 commit into
masterfrom
codex/openapi-strong-schema-tooling

Conversation

@eviltester

Copy link
Copy Markdown
Owner

Summary

  • add strongschema=true and pathparams=operation controls for generated OpenAPI docs
  • emit stronger primitive, UUID/date, and validation schemas from Thingifier-owned metadata
  • document generated error responses through ThingifierError
  • document scoped-session/auth security and configured credential failure responses

Verification

  • pre-commit full Maven verification passed across the 14-module reactor
  • targeted mvn -pl thingifier -am test passed earlier: 1123 tests, 0 failures
  • mvn -pl thingifier -am -DskipTests verify passed earlier
  • git diff --check passed earlier

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T09:19:31.697689Z 3f72bd4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@eviltester
eviltester merged commit d5b3b78 into master Sep 16, 2026
3 checks passed
@eviltester
eviltester deleted the codex/openapi-strong-schema-tooling branch September 16, 2026 09:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f72bd4eed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1098 to +1102
!config.strongSchemas
&& config.pathParameterPlacement
== SwaggerGenerationConfig.PathParameterPlacement.PATH
&& (!config.includeMethodNotAllowedEndpoints
|| !config.includeFieldValidation);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor validation-disabled serialization configs

When callers use the new asJson(SwaggerGenerationConfig) overload with includeMethodNotAllowedEndpoints=false and includeFieldValidation=false, this predicate marks the configuration cacheable and the later branch returns apiNormal. The resulting JSON therefore has required request bodies and typed path parameters even though validation was explicitly disabled; cache only the exact normal and permissive profiles, or serialize this combination directly.

Useful? React with 👍 / 👎.

Comment on lines 369 to +376
// add individual entity schema
ObjectSchema object = asObjectSchema(objectSchemaDefinition);
ObjectSchema object =
asObjectSchema(objectSchemaDefinition, false, config.strongSchemas);
components.addSchemas(objectSchemaDefinition.getName(), object);

// add create schema with ID removed for auto added ids
ObjectSchema createObject = asCreateObjectSchema(objectSchemaDefinition);
ObjectSchema createObject =
asCreateObjectSchema(objectSchemaDefinition, config.strongSchemas);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate strong schemas into collection items

With strongSchemas=true, the flag is applied to the singular entity and create components here, but the plural component is still built by asJsonCollectionObjectSchema, whose item schema calls the default asObjectSchema(..., false). Consequently a single-object response advertises min/max/pattern constraints while the same objects returned from a collection do not; pass the strong-schema setting through the collection and XML collection helpers too.

Useful? React with 👍 / 👎.

Comment on lines +726 to +729
private void ensureThingifierErrorSchema(final Components components) {
if (components.getSchemas() != null
&& components.getSchemas().containsKey(THINGIFIER_ERROR_SCHEMA_NAME)) {
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid colliding with user-defined error schemas

If a model already defines an entity or view named ThingifierError, this early return treats that unrelated component as the standard error schema. Every generated 4xx/5xx response will then reference the user's schema rather than an object containing errorMessages; reserve a collision-proof component name or verify/replace the existing component before reusing it.

Useful? React with 👍 / 👎.

Comment on lines +963 to +964
if (rule instanceof MatchesRegexValidationRule) {
schema.setPattern(((MatchesRegexValidationRule) rule).getRegexToMatch());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve whole-string regex semantics

For a MatchesRegexValidationRule, runtime validation uses Java Matcher.matches() and requires the entire value to match, whereas OpenAPI/JSON Schema pattern succeeds when any substring matches. For example, a rule [A-Z]+ rejects abcABC at runtime but the generated strong schema accepts it; wrap this rule's expression with whole-string anchors (while handling existing anchors) rather than copying it directly.

Useful? React with 👍 / 👎.

Comment on lines +43 to +49
Assertions.assertEquals(
"string", createTodoProperties.getAsJsonObject("title").get("type").getAsString());
Assertions.assertEquals(
"boolean",
createTodoProperties.getAsJsonObject("doneStatus").get("type").getAsString());
Assertions.assertEquals(
"integer", todoProperties.getAsJsonObject("id").get("type").getAsString());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Parameterize the field-type schema cases

This test checks separate string, boolean, and integer mapping branches in one broad method. Convert these equivalent mapping examples into a parameterized table (including component/property/type), so each row identifies the broken type mapping and the scenario matrix remains visible as required by the repository test rules.

AGENTS.md reference: AGENTS.md:L17-L20

Useful? React with 👍 / 👎.

Comment on lines +67 to +70
Assertions.assertEquals(
"title", createTodo.getAsJsonArray("required").get(0).getAsString());
Assertions.assertEquals(1, title.get("minLength").getAsInt());
Assertions.assertEquals(50, title.get("maxLength").getAsInt());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Split independent strong-schema validation rules

The assertions combine three independent decisions—mandatory fields becoming required, not-empty becoming minLength, and maximum length becoming maxLength—so one test covers multiple domain rules. Split these into named tests so each validation-rule mapping fails independently.

AGENTS.md reference: AGENTS.md:L6-L8

Useful? React with 👍 / 👎.

Comment on lines +887 to +888
.onMissingRequiredCredential(401, "Missing scoped session")
.onInvalidCredential(403, "Invalid scoped session")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Split missing and invalid credential scenarios

Missing credentials and invalid credentials are separate authentication decisions with independently configurable statuses, but this test configures and verifies both together. Give each policy its own test so a regression in one credential path is isolated rather than sharing setup and intent with the other.

AGENTS.md reference: AGENTS.md:L6-L8

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant