Skip to content

Fix latest SDK generation#16

Open
damaz91 wants to merge 40 commits intomainfrom
fix-2026-01-23
Open

Fix latest SDK generation#16
damaz91 wants to merge 40 commits intomainfrom
fix-2026-01-23

Conversation

@damaz91
Copy link
Contributor

@damaz91 damaz91 commented Mar 2, 2026

Fixes critical issues in schema generation

damaz91 and others added 28 commits February 6, 2026 10:10
Change-Id: I7400c7bd870e3505d5b8c9a9e179d305c65bb3dc
Change-Id: I4583f94619b072eb7aff0fc28f040d0b2fd30de3
Change-Id: Ib7d74192095677f98a79906f5ed2d69dc16e1520
Change-Id: I2e70bdaf468ef7663b6c8e7542f2acf822d9df06
Change-Id: Id33ccc029b86af2486c82dc85d8bb12b3c55c680
Change-Id: Ia518ec52de6906da7262f7a76704a676a6318c40
Change-Id: I113bf00366152f552140a0f6410f738813c44007
Change-Id: I8413a4ad2e3886df6684ff7f654faa2ed2a95043
Change-Id: I63be54dcfc253861c05a9143483fd73a98f2c232
Change-Id: If59a9d92e40d71bc9d69d171b7020310ee9e26a1
Change-Id: I79bccca52f3a1d9d721c6a6f10d128f544411840
Change-Id: I0ac8995f2d15caa97ce57e9a1be574f012d5b9f2
* update SDK to 2026-01-23

* add init at the base level

* update README

* add request specific classes

* fix schema generation

* fix schema generation

* Update pyproject.toml

* update pre-processing to correctly handle self-reference

* fix

* sync

* address comments

Change-Id: I7400c7bd870e3505d5b8c9a9e179d305c65bb3dc

* add win32 specific check for paths

Change-Id: I4583f94619b072eb7aff0fc28f040d0b2fd30de3

* remove preprocessing

Change-Id: Ib7d74192095677f98a79906f5ed2d69dc16e1520

* update readme

Change-Id: I2e70bdaf468ef7663b6c8e7542f2acf822d9df06

* re-run of generate_models.sh

Change-Id: Id33ccc029b86af2486c82dc85d8bb12b3c55c680

* move ruff config

Change-Id: Ia518ec52de6906da7262f7a76704a676a6318c40

* delete temp files

Change-Id: I113bf00366152f552140a0f6410f738813c44007

* add LICENSE reference

Change-Id: I8413a4ad2e3886df6684ff7f654faa2ed2a95043

* add preprocessing to handle request type class generation

Change-Id: I63be54dcfc253861c05a9143483fd73a98f2c232

* change naming convention

Change-Id: If59a9d92e40d71bc9d69d171b7020310ee9e26a1

* update preprocessing to include more request types

Change-Id: I79bccca52f3a1d9d721c6a6f10d128f544411840

* delete ucp

Change-Id: I0ac8995f2d15caa97ce57e9a1be574f012d5b9f2
Change-Id: I50829c0f09a4e05bfcbd7ec53286a63f09e28cea
Change-Id: I769a18ba3fe14325911c4194da12f3f97ece46ea
Change-Id: Ie9d5ab50422b82efbf558cdd179ed3485cfde60f
@damaz91 damaz91 requested a review from a team as a code owner March 2, 2026 18:17
Change-Id: I6d267035aa48aa5460c31a3764eab5a460026510
damaz91 added 10 commits March 2, 2026 21:03
Change-Id: Ie4dd0293179c4387863dd4e66f51dde8443dd9b3
Change-Id: I07006baf7aa7cd08b2ab723589b9373379e03d31
Change-Id: I66ced7ef4174da92816eb6cb50338a55ea68f67a
Change-Id: I5b8706c16740edca1b1c3a2b72ea5125b34ae0b5
Change-Id: Ia8d329b4b737a45a2a05fab59fc4c9e3c2a52efe
Change-Id: Ib54ea5de5be7ff65cf06ff14d0f90cd328636f6c
Change-Id: Id43fd21393ce74d863eca3407a967bb1d01e950d
Change-Id: Ia88b6b2c128a57a4499e3eb0fa5437ddbaaf535a
Change-Id: I2dc40c7312c2dd22fc3d03d426b7c5359938611c
Change-Id: I438b93b4adb693018f43428bf8e658bb5809ab74
Copy link

@nicholasjameshall nicholasjameshall left a comment

Choose a reason for hiding this comment

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

As mentioned in person, also some validation errors:

  • spec should be required in PlatformSchema8 according to service.json
  • id is required for payment_handler
  • in service.json, if transport in rest or mcp, schema and endpoint are required (PlatformSchema9 [rest] and PlatformSchema10 [mcp]

new_properties[prop_name] = prop_copy
if is_required:
new_required.append(prop_name)
schema_file_path = Path(schema_file)

Choose a reason for hiding this comment

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

This function is pretty huge. I would personally break it up into separate functions since A) it'll be much easier to maintain and B) you can reduce a lot of the nesting of ifs.



def flatten_entity(schema, entity_def):
"""Iteratively replaces refs to 'ucp.json#/$defs/entity' with the actual schema to flatten inheritance."""

Choose a reason for hiding this comment

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

Please add some comments. Why do we even do this?

schema_dir_path = Path(schema_dir)
if not schema_dir_path.exists():
print(f"Directory {schema_dir} does not exist.")
return

Choose a reason for hiding this comment

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

maybe raise an error / exception here?

return

# Fix metadata types before processing
fix_ucp_metadata(schema_dir_path)

Choose a reason for hiding this comment

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

I would rename this or improve the comment. What is "fixing"? Also ideally this function would return something instead of performing a side-effect (especially if we want to add a test for this at some point..?)

op_val = ucp_req.get(op)
if op_val == "omit" or op_val is None:
include = False
# Flatten entity references immediately

Choose a reason for hiding this comment

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

why? comment would be helpful

Choose a reason for hiding this comment

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

in fact, if entity_def remains an empty object... is this expected behaviour? should we throw in this case?

except Exception as e:
print(f"Error processing {f}: {e}")

# 3. Transitive dependency tracking (Parent -> Child):

Choose a reason for hiding this comment

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

is it possible to split these steps into separate functions to make this easier to read / isolate functionality? it will also allow you to remove some of the condition nesting, and also to just consolidate logic (e.g. all_variant_needs is defined way up at the top of this function and it's not clear what it represents)

return p.parent / f"{p.stem}_{op}_request.json"


def generate_variants(schema_file, schema, ops, all_variant_needs):

Choose a reason for hiding this comment

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

maybe a comment on what this function is doing?

Change-Id: I7112ad7d531eee33ea48de1c2871b0b92afe5e02
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.

2 participants