Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.36k stars 2k forks source link

Regenerate SDKs to Use Stream Style Serialization #35082

Closed alzimmermsft closed 2 months ago

alzimmermsft commented 1 year ago

Steps to onboard stream style serialization workflow for SDK's

NOTE: Only JSON-based SDKs can be migrated at this time

  1. Add azure-json as a runtime dependency in your pom.xml and add requires transitive com.azure.json to your module-info.java.

  2. Add stream-style-serialization: true to Code generation settings in respective swagger/autorest.md. This will result in generated model types implementing JsonSerializable<T> and will remove Jackson Databind annotations.

  3. If your SDK uses custom Jackson Databind handling replace it with custom azure-json handling. azure-json works similarly to Jackson's JsonGenerator and JsonParser by handling JSON payloads using a streaming API. This includes removing all JacksonAdapter usage in handwritten code, any usage of JacksonAdapter in generated code will be removed by updates to Autorest Java in the future.

  4. Once migrated run local testing to verify before opening a PR. Once the PR is opened run live testing as final validation.

For SDKs that have extensive handwritten layers that transform to the generated code, leave the handwritten layer as is, aside from removing usage of Jackson Databind. This will make the migration easier for now, long term it should be investigated to use Autorest Java code customizations to reduce the size of the transformation layer, reducing maintenance costs for the SDK.

If any issues are found in the code generated by Autorest Java please file an issue in https://github.com/Azure/autorest.java and assign it to alzimmermsft tagged with v4.

Service Library Driver Status Notes
App Configuration azure-data-appconfiguration @alzimmermsft https://github.com/Azure/azure-sdk-for-java/pull/34231
Container Registry azure-containers-containerregistry @alzimmermsft https://github.com/Azure/azure-sdk-for-java/pull/33528
Core azure-core @alzimmermsft https://github.com/Azure/azure-sdk-for-java/pull/37046
Event Grid azure-messaging-eventgrid @billwert https://github.com/Azure/azure-sdk-for-java/pull/38015
Event Hubs azure-messaging-eventhubs Done (doesn't use JSON)
Form Recognizer azure-ai-formrecognizer @samvaity https://github.com/Azure/azure-sdk-for-java/pull/38067
Identity azure-identity @alzimmermsft https://github.com/Azure/azure-sdk-for-java/pull/35385
Key Vault azure-security-keyvault-administration @alzimmermsft https://github.com/Azure/azure-sdk-for-java/pull/34556
Key Vault azure-security-keyvault-certificates @vcolin7 https://github.com/Azure/azure-sdk-for-java/pull/36724
Key Vault azure-security-keyvault-keys @vcolin7 https://github.com/Azure/azure-sdk-for-java/pull/36920
Key Vault azure-security-keyvault-secrets @alzimmermsft https://github.com/Azure/azure-sdk-for-java/pull/36461
Metrics Advisor azure-ai-metricsadvisor @samvaity @anuchandy https://github.com/Azure/azure-sdk-for-java/pull/37974
Monitor Ingestion azure-monitor-ingestion @lmolkova / @srnagar / @jairmyree
Monitor Query azure-monitor-query @lmolkova / @srnagar /@jairmyree
Open AI azure-ai-openai
Schema Registry azure-data-schemaregistry @conniey https://github.com/Azure/azure-sdk-for-java/pull/37858
Search azure-search-documents @alzimmermsft https://github.com/Azure/azure-sdk-for-java/pull/33476
Service Bus azure-messaging-servicebus Blocked (requires azure-xml to be shipped)
Tables azure-data-tables Blocked (requires azure-xml to be shipped)
Text Analytics azure-ai-textanalytics @mssfang https://github.com/Azure/azure-sdk-for-java/pull/37238
alzimmermsft commented 2 months ago

Closing as this has been completed.