Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Schemas & client libraries.#4179

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lovelydinosaur merged 32 commits intomasterfromschema-support
Jul 4, 2016
Merged

Schemas & client libraries.#4179

lovelydinosaur merged 32 commits intomasterfromschema-support
Jul 4, 2016

Conversation

@lovelydinosaur
Copy link
Contributor

@lovelydinosaurlovelydinosaur commentedJun 8, 2016
edited
Loading

Support for schema generation & dynamic client libraries.

See thenew tutorial section,schema documentation, andapi client documentation.

Needed to complete tutorial 7:

  • Graceful behavior with or without Core API installed.
  • Add--auth basic support to Core API.
  • Check permissions on schema generation.
  • Include pagination parameters in automatic schemas.

Other work as part of this, prior to 3.4.0 release.

  • Include filter parameters in automatic schemas.
  • Schema documentation.
  • HandleDocument,Error andLink in JSON renderer?
  • HandleListSerializer and other non-form.
  • Handle multipart vs json and/or other encodings.
  • Tests.
  • Handle text downloads.
  • Client library documentation.
  • Add coreapi to list of optional packages on homepage.

Moved to separate tickets:

  • Easier overrides onSchemaGenerator
  • Document using OpenAPI and other schema formats.
  • Move alternate formats incoreapi into separate packages. (HTML, OpenAPI, HyperSchema, HAL...)

Deferred:

  • Handle binary downloads.Not strictly required for 3.4
  • Useid notpk in schema representations or change serializer representations?Not strictly required for 3.4
  • Add to quickstartNot strictly required for 3.4

auvipy, debnet, decentral1se, sebdiem, RobertKolner, kmwenja, Stranger6667, and limdauto reacted with heart emoji
renderer_classes=view_renderers

defget(self,request,*args,**kwargs):
ifrequest.accepted_renderer.format=='corejson':
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason why this couldn't be brought into theCoreJSONRenderer?

Copy link
ContributorAuthor

@lovelydinosaurlovelydinosaurJun 15, 2016
edited
Loading

Choose a reason for hiding this comment

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

The problem is less what to do withCoreJSONRenderer and more about making sure that we preserve the behavior of that view for anything thatisn't a schema renderer.

(Also I'd consider that part still slightly in flux - clearly needs refinement)

Copy link
Contributor

Choose a reason for hiding this comment

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

making sure that we preserve the behavior of that view for anything that isn't a schema renderer

Right, my main concern with that line (which I'm sure will probably change another few times before this is merged) is that it's hard-codingcorejson as the only renderer with schema support.

Also I'd consider that part still slightly in flux - clearly needs refinement

Definitely understandable.

returnencode_multipart(self.BOUNDARY,data)


classCoreJSONRenderer(BaseRenderer):
Copy link
Contributor

Choose a reason for hiding this comment

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

There was a move in 3.1 to remove features which had third-party dependencies from the core and put them into third-party packages that were still highly visible. Seedjango-rest-framework-xml,django-rest-framework-yaml, anddjango-rest-framework-oauth for examples.

Is that still something we are pushing for?

Copy link
ContributorAuthor

@lovelydinosaurlovelydinosaurJun 15, 2016
edited
Loading

Choose a reason for hiding this comment

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

Kinda. I seecoreapi as a foundational thing here, so it's a bit different.

The various types of schema and docs that you can use it to generate will be third party, yup.
So eg we can have third party packages for schema formats: Swagger / API Blueprint / JSON Hyperschema, for docs templates driven by a coreapi.Document object, and for various hypermedia styles.

Usingcoreapi ensures that we're able to provide a common interface for all of those, so I don't have any great issues with pulling it in. If it's in core, then we're making the promise that it's an interface that is available to third-party devs, which should help drive folks making schema renderers / hypermedia renderers and docs renderers. Having said that, wecould push for it to be third-party, if we wanted to, so I might be open to discussion.


router = DefaultRouter(schema_title='Server Monitoring API')

The schema will be included in by the root URL, `/`, and presented to clients

Choose a reason for hiding this comment

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

"included in by" seems confusing. Maybe take out the "by"?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch, that's a typo.

@lovelydinosaur
Copy link
ContributorAuthor

Remaining issues have now been split out into individual tickets.
Plan is to prepare up a 3.4.0 release, then resolve as many remaining tickets in the time remaining before Thursday 14th July, with a release planned on or before that date.

(Ensure it will be released prior to DjangoCon US, and give at least one clear working day to resolve any ciritical issues, post-release)

@marcgibbons
Copy link
Contributor

💯

@lovelydinosaur
Copy link
ContributorAuthor

Yeah. Indeed.

returntemplate_render(template,context)

defget_fields(self,view):
filter_class=getattr(view,'filter_class',None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it make more sense to useself.get_filter_class here?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Possibly, tho we don't actually have aqueryset/model available to us at this point, so couldn't dynamically generate the filter class if none was set explicitly.

Copy link
Contributor

Choose a reason for hiding this comment

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

What are the problems with just callingview.get_queryset()?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Sure, that'd probably work okay.

rlucioni pushed a commit to openedx/course-discovery that referenced this pull requestJul 12, 2017
DRF 3.4.7 is the same version run by edx/credentials. Release notes are athttp://www.django-rest-framework.org/topics/release-notes/#34x-series. Highlights include: support for Django 1.10 (encode/django-rest-framework#4158 - sigh), support for schema generation (encode/django-rest-framework#4179 - required for newer versions of django-rest-swagger), and a change that prevents paginated views from re-running queries when count queries return 0 (encode/django-rest-framework#4201 - this explains the expected query count changes made in tests).LEARNER-1590
rlucioni pushed a commit to openedx/course-discovery that referenced this pull requestJul 12, 2017
DRF 3.4.7 is the same version run by edx/credentials. Release notes are athttp://www.django-rest-framework.org/topics/release-notes/#34x-series.Highlights include:    - [Support for Django 1.10](encode/django-rest-framework#4158) - sigh    - [Support for schema generation](encode/django-rest-framework#4179) - required for newer versions of django-rest-swagger    - A [change](encode/django-rest-framework#4201) that prevents paginated views from re-running queries when count queries return 0 - this explains the expected query count changes made in testsLEARNER-1590
rlucioni pushed a commit to openedx/course-discovery that referenced this pull requestJul 12, 2017
DRF 3.4.7 is the same version run by edx/credentials. Release notes are athttp://www.django-rest-framework.org/topics/release-notes/#34x-series. Highlights include:1. [Support for Django 1.10](encode/django-rest-framework#4158) - sigh2. [Support for schema generation](encode/django-rest-framework#4179) - required for newer versions of django-rest-swagger3. A change that [prevents paginated views from re-running queries](encode/django-rest-framework#4201) when count queries return 0 - this explains the expected query count changes made in testsLEARNER-1590
rlucioni pushed a commit to openedx/course-discovery that referenced this pull requestJul 12, 2017
DRF 3.4.7 is the same version run by edx/credentials. Release notes are athttp://www.django-rest-framework.org/topics/release-notes/#34x-series. Highlights include:1. [Support for Django 1.10](encode/django-rest-framework#4158) - sigh2. [Support for schema generation](encode/django-rest-framework#4179) - required for newer versions of django-rest-swagger3. A change that [prevents paginated views from re-running queries](encode/django-rest-framework#4201) when count queries return 0 - this explains the expected query count changes made in testsLEARNER-1590
@swehba
Copy link

@tomchristie FYI, the links in your original comment at the top of this thread are broken.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@rpkilbyrpkilbyrpkilby left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.4.0 Release

Development

Successfully merging this pull request may close these issues.

8 participants

@lovelydinosaur@codecov-io@marcgibbons@swehba@nealtodd@kevin-brown@rpkilby@foresmac

[8]ページ先頭

©2009-2025 Movatter.jp