Skip to content
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

Different field_name on different object returned #358

Open
Dvergatal opened this issue May 3, 2022 · 0 comments · May be fixed by #359
Open

Different field_name on different object returned #358

Dvergatal opened this issue May 3, 2022 · 0 comments · May be fixed by #359

Comments

@Dvergatal
Copy link

I am currently struggling with a difficult problem to solve. because what i want to do is to prepare a data class for azure cloud to i.e. update device attestation.

The problem which I'm facing is that a sample request for i.e. Symmetric Key looks like this:

{
  "type": "symmetricKey",
  "symmetricKey": {
    "primaryKey": "<primary key>",
    "secondaryKey": "<secondary key>"
  }
}

as you can see in another json code block for i.e. TPM:

{
  "type": "tpm",
  "tpm": {
    "endorsementKey": "<endorsement key>"
  }
}

you can see that the second field changes according to the name of class. Now I have these classes written and have a factory function returning, specified by this first type variable, object. The problem which I'm facing is that the name of this object in json is the name of variable not the name of the returned object type. I was thinking of using this field_name parameter from the field module, in order to change it's name but it's not possible, or maybe i dunno how to do that, to change it depending on the returned object type.

I would be pleased if somebody might have a solution for this use case.

@Dvergatal Dvergatal linked a pull request May 5, 2022 that will close this issue
@matt035343 matt035343 linked a pull request Jun 10, 2023 that will close this issue
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 a pull request may close this issue.

1 participant