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

Add schema generation support for plain GeometryFields #259

Conversation

AndrewGuenther
Copy link
Contributor

The intial implementation of schema generation only supported
serializers which subclassed GeoFeatureModel*Serializer. This meant that
models which have standalone GeometryFields would not properly generate
a schema. This change adds support for that use case.

Fixes #257

@AndrewGuenther AndrewGuenther marked this pull request as draft July 13, 2021 16:47
@AndrewGuenther
Copy link
Contributor Author

Fairly simple change, but looking for some feedback on the best way to write a test for this.

@AndrewGuenther AndrewGuenther marked this pull request as ready for review July 13, 2021 17:21
serializer = inspector.get_serializer(path, method)
content = inspector.map_serializer(serializer)

print(content)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we compare content against the expected value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely haha. That's my bad, I had uncommitted changes before pushign

Copy link
Collaborator

@dhaval-mehta dhaval-mehta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small change. Everything else is looking good to me. 👍🏼

Copy link
Collaborator

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check the failing tests please

@AndrewGuenther AndrewGuenther force-pushed the support-schema-generation-for-geometry-fields branch from 7735af3 to a396ca8 Compare July 14, 2021 15:59
@AndrewGuenther
Copy link
Contributor Author

I believe I've resolved all the issues. Fwiw, the run-qa-checks script is pretty busted on anything but a clean checkout. It tries to run checks on files in the .gitignore and virtual environments so it always failed for me locally. Could have saved a round trip if that had worked locally.

…#257

The intial implementation of schema generation only supported
serializers which subclassed GeoFeatureModel*Serializer. This meant that
models which have standalone GeometryFields would not properly generate
a schema. This change adds support for that use case.

Closes openwisp#257
@AndrewGuenther AndrewGuenther force-pushed the support-schema-generation-for-geometry-fields branch from a396ca8 to 99ee740 Compare July 14, 2021 16:03
@AndrewGuenther AndrewGuenther requested a review from auvipy July 14, 2021 16:04
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On question, do we need to update anything in the docs or is this just a pure bugfix?

@AndrewGuenther
Copy link
Contributor Author

I'd say it's a pure bug fix. The documentation says that schema generation is supported, but it was only working for a specific case. This change ensures that schema generation works for all field types.

@AndrewGuenther
Copy link
Contributor Author

The test failures seem related to some DB setup, not anything to do with this change.

nemesifier
nemesifier previously approved these changes Jul 14, 2021
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
@dhaval-mehta @auvipy any idea why this failure? "database connection isn't set to UTC". Looks a psycopg issue to me, most probably is happening in master as well.

dhaval-mehta
dhaval-mehta previously approved these changes Jul 14, 2021
@dhaval-mehta dhaval-mehta dismissed stale reviews from nemesifier and themself via f291c95 July 14, 2021 16:44
@dhaval-mehta
Copy link
Collaborator

LGTM
@dhaval-mehta @auvipy any idea why this failure? "database connection isn't set to UTC". Looks a psycopg issue to me, most probably is happening in master as well.

Yes. psycopg/psycopg2#1293
@nemesisdesign Please re-approve PR.

@auvipy auvipy merged commit ccca7cc into openwisp:master Jul 15, 2021
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.

Openapi schema generation does not support serializers not subclassing GeoFeatureModelSerializer
4 participants