Skip to content

Conversation

CharlesDuboisSAP
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP commented Feb 18, 2025

Context

Support allFields in OpenAPI generator #165

When the model classes are re-generated and receive additional fields, getCustomField(String) can now throw NoSuchElementException instead of returning a value, making it a breaking change upon re-generating.
toMap() would returns the same map every time, no matter the spec and generated model class.

Corresponding AI SDK PR

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Documentation updated
  • Release notes updated

@CharlesDuboisSAP CharlesDuboisSAP added the please review Request to review a pull request label Feb 18, 2025
@CharlesDuboisSAP CharlesDuboisSAP self-assigned this Feb 18, 2025
@CharlesDuboisSAP CharlesDuboisSAP changed the title feat: [OpenAPI] Add getAllFields() and deprecate getCustomField(String) feat: [OpenAPI] Add toMap() and deprecate getCustomField(String) Feb 18, 2025
Base automatically changed from httpclient5 to main February 19, 2025 08:18
public Map<String, Object> toMap()
{
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
{{#vars}}if( {{name}} != null ) declaredFields.put("{{name}}", {{name}});
Copy link
Contributor

Choose a reason for hiding this comment

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

We could've used getter instead of direct field access. But I think it's fine (for now)

@CharlesDuboisSAP CharlesDuboisSAP merged commit d0b98d2 into main Feb 20, 2025
14 checks passed
@CharlesDuboisSAP CharlesDuboisSAP deleted the getallfields branch February 20, 2025 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please review Request to review a pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants