-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
single upsert
and bulk Upsert
accept divergent document types
#22310
Comments
Hi @xirzec - I see you've been somewhat active on this issue, so I'm just reaching out to see if you know any further details on this? I see it has been added to the "2022-08 milestone" - does this mean the issue has been acknowledged and planned to be fixed for then? I'm seeing this exact issue when trying to save an object which has a Any help / comments on this would be appreciated to help us know whether we're going about this in the right way. Should we be manually converting the object to satisfy the |
Hey @cjshelton, I'm far from a Cosmos expert but my understanding is that in your case, yes, you'll want to convert your Date object to a string first. The JavaScript |
Yep that's what I've been thinking. Thanks for taking the time to respond @agorischek |
I'm also not a cosmos expert, but if it works with type casting it seems we might just need to fix our typings here? I'll let @sajeetharan and @jay-most comment as to when this work will be able to be completed |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @bkolant-MSFT, @sajeetharan, @pjohari-ms. Issue Details
Describe the bug To Reproduce
Expected behavior Additional context // Case 1: Plain object
const document1 = { id: "1" };
// TypeScript is fine with this and the operation succeeds
await container.items.upsert(document1);
// Case 2: Class
class Document {
constructor(public id: string) {}
}
const document2 = new Document("2");
// TypeScript complains:
// Type 'Document' is not assignable to type 'JSONObject'.
// Index signature for type 'string' is missing in type 'Document'.ts(2322)
await container.items.batch([
{
operationType: "Upsert",
resourceBody: document2,
},
]);
// Case 3: Class with type casting
const document3 = new Document("3");
// Operation succeeds
await container.items.bulk([
{
operationType: "Upsert",
resourceBody: document3 as unknown as JSONObject,
},
]);
|
Initial version of the code-signing dataplane service (Azure#22310) * Initial version of the code-signing dataplane service * Remove error objects since those come from the Azure Core namespace * fix: added azure.codesigning.json resulting file * fix: use newer version dependency syntax * Rolling back version change per PR feedback * fix: polling operation mapping per PR feedback * Adding x-ms-examples for example validation * fix: added custom-words per PR feedback * Renamed parameter definition to match open api json definition * fix: modified the api-version to synch up with the folder api-version * Adding details json cadl validation * refactor: moved from cadl to typespec * chore: attach azure.codesiging.json definition * chore: remove package-lock.json since its unneeded. * feat: adding get sign eku operation & example fix: sign long running operation * chore: removed unused swagger.json generated * chore: removing data-plane swagger generated, keeping just the typespec project * Readding the swagger information for dataplane service * fix: ci issues pointed examples are not referenced on the swagger file resources should not be read only * added examples to typespec definition * fix: examples * more fixes for example.json operations * even more fixes for example.json operations * fix: minor Remove optional parameter from region. since its required. Added description to namespace definition Removed optional parameter from operation status, since the id is required. Added suppression of warning * Added fixes to azure.codesigning.json generation * Added required property of id to examples * Switched property to a more descriptive naming for the eku response * fix: moved examples to a non version specific folder * fix: the compiler didnt liked not using the preview folder, rolling back * feat: added oauth2 security definition * fix: removed api-version from example path * style: change casing of operations to camel case fix: per guidance modified the getsignEku operation into listSignEku * Update azure.codesigning.json generated by tsp compiler * fix: modified ResourceAction to LongRunningResourceAction per feedback * docs: added enum descriptions to each value on hash algorithms * fix: pinned to current versions to avoid ci errors by using latest dependency * Added prefix of StandardResourceOperations interface to Resource operations * fix: sign operation should return 202 Accepted on example * fix: sign operation should return 202 Accepted on example * style: tsp format result * refactor: removed unused mapping to parent resource * refactor: removing typespec-python emitter * Adding get sign root certificate operation * fix: adding custom word rootcert * fix: adding api version parameter * Added resource provider folder per ci finding * chore: removing package.json per PR feedback * Renaming folder to remove "Microsoft." path per feedback from PR see: https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/typespec-structure-guidelines.md for guidelines * feat: expanded the typespec options to include the lang generation * Fix: Based on review from API stewardship team Added more detailed information for docs and summary of operations Refactored getSignRootCertificate operation to use RpcOperation instead of custom operation Pluralized the listSignEkus operation Renamed models to provide more detailed description of their purposed Eliminated the custom enum in favor of the typespec enum provided * refactor: moved version to 2023-06-15 based on feedback of ACS Eng team * refactor: renamed models following azure team feedback * Update tspconfig.yaml Applied latest schema of emitter options and parameters. * fix: adding back missing custom words, fixing coffeelake casing * docs: updated samples to include varied hashes to represent a more familiar request for customers * docs: updated the docs clauses of the typespec file to avoid repetitions on the docs generated. * fix: update README.md of data-plane generation to include the correct tag * Regenerated azure.codesigning.json file * Based on pr build feedback, updated custom words definition * docs: per compiler feedback, adding doc definition for versioning * fix: outdated examples of data-plane swagger * fix: per PR feedback, using T payload for Foundations.OperationStatus * chore: updated Azure.CodeSigning swagger generated using tsp v0.46.0 * fix: removed autorest from the dependencies per feedback fix: added suppression for custom RPC operation * Removing json examples for compliance with avocado pipeline * fix: Adding examples to tsp directory * Corrected samples --------- Co-authored-by: Ray Chen <[email protected]>
Hi @agorischek, we deeply appreciate your input into this project. Regrettably, this issue has remained unresolved for over 2 years and inactive for 30 days, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support. |
@azure/cosmos
3.16.1
16.15.1
4.7.4
Describe the bug
The
Upsert
bulk operation accepts fewer input types than theupsert
non-bulk method. The bulk approach requires aJSONObject
, while the singleupsert
approach acceptsunknown
. This seems to prevent submitting documents that are instances of custom classes in bulk. Is this intentional?To Reproduce
bulk
methodExpected behavior
Object is written as document, just like as if
upsert
were called directly.Additional context
Code sample:
The text was updated successfully, but these errors were encountered: