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
Ordering output doesn't work for auto_field #306
Comments
I think I have worked out a fix, but I'm not a maintainer so would have to wait until someone is able to pay the issue some attention. Say with this model: class MyModel(Base):
__tablename__ = "mymodel"
id = Column(Integer, primary_key=True, autoincrement=True)
some_field = Column(Integer, nullable=False) and this schema (no class MyModelSchema(SQLAlchemyAutoSchema):
class Meta:
model = MyModel
ordered = True ... an instance serialized to: And with this schema (with class MyModelSchema(SQLAlchemyAutoSchema):
class Meta:
model = MyModel
ordered = True
some_field = auto_field() ... the same instance serialized to: Is it confusing, expected, or doesn't matter that the declared field is ordered before the auto generated field? |
If we can get consistent result, I think order of field doesn't matter. |
Release in 0.23.0 |
In marshmallow, to order serialization output, set ordered = True in the Meta class as follows.
It works well without
auto_field
, but it generate following error withauto_field
.Is there any solution for this?
The text was updated successfully, but these errors were encountered: