Skip to content

Conversation

@gsakkis
Copy link

@gsakkis gsakkis commented Mar 21, 2023

Supersedes #273 in fixing #272.

@gsakkis gsakkis force-pushed the fix-optional-embedded-model branch from 5b11b67 to a2f33f2 Compare March 22, 2023 22:08
@SYNchroACK
Copy link

@art049

@torrell8
Copy link

Hello, I am experiencing the same problem.
Is there an update on this merge request?

@yutongp
Copy link

yutongp commented Sep 21, 2023

@art049 this is quite essential feature. I ran into this issue the first time I use odmantic. Is there any update for a merge?

@art049 art049 force-pushed the master branch 2 times, most recently from 5bd1656 to a99a258 Compare November 3, 2023 20:39
AndyBryson added a commit to AndyBryson/odmantic that referenced this pull request Aug 9, 2024
@Cajuteq
Copy link

Cajuteq commented Oct 11, 2024

@art049 Sorry for pinging you but this PR seems quite compact to review and would resolve quite a lot of (mostly redundant) issues.
So far I have found Issues #272 #350 #370 #477 #484 and PR #273 #344 #485 to be somehow related.
Maybe you could take a look.

@WolfgangWenzel
Copy link

It is really sad that his is not fixed but i think there is a workaround which works for some use-cases: make the embedded model not optional and write a model-validator 'before' which adds the field with some default values:

    @model_validator(mode='before')
    @classmethod
    def add_slurm_parameters(cls, data):
        if not 'slurm_parameters' in data or data['slurm_parameters'] is None:
            data['slurm_parameters'] = SlurmParameters()
        return data

here slurm_parameters (which is the embedded model) is created with some defaults when not present.

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.

6 participants