| Commit message (Collapse) | Author | Age |
|
|
|
|
|
| |
Tested using 'yamllint'.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
|
| |
As noted in a bug against the spec [1], there is some duplication here.
Go with the more obvious path until that confusion is cleared up.
[1] https://github.com/OAI/OpenAPI-Specification/issues/1788
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RFC2822 states that long headers can be wrapped using CRLF followed by
WSP [1]. For example:
Subject: Foo bar,
baz
Should be parsed as:
Foo bar,baz
While we were stripping the former, we were not stripping the
latter. This mean that we ended up with the following:
Foo bar, baz
Resolve this.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #197
|
|
|
|
|
|
|
|
|
|
| |
Django Admin seems to be doing something funky with how it's handling
the creation of a User's corresponding UserProfile instance when
modelled as an inline field. Re-setting the UserProfile.user attribute
seems to resolve the issue, so do just that.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #110
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add validation using the rather excellent 'openapi_core' library. The
biggest issue we have to contend with is the fact that 'openapi_core'
expects us to be able to provide a templated URL string for each request
(e.g. '/api/patches/123/' would become '/api/patches/<id>/') and Django
doesn't provide a way to do this [*]. We work around this by
reverse-engineering some of the Django code to turn a URL to its
matching regex, which we can then easily convert into a template string.
It's kind of hacky and not at all portable but, crucially, it does work
and has highlighted some nice bugs in the API that have already merged.
Going forward, we can probably modify 'openapi_core' somewhat to remove
the need for the templated URL string. If and when this happens, most of
the funkier code here can happily go away.
[*] Django 2.0+ [1] does actually provide a way to do template
string-based URLs and in fact recommends them now, with regexes being
reserved for more advanced corner cases. However, we don't want to drop
support for the Django 1.11 yet as it is the most recent LTS release.
[1] https://docs.djangoproject.com/en/2.1/ref/urls/#django.urls.path
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
| |
This was incomplete and wrong in many places. It's since been replaced
by the OpenAPI 3.0.0 specs, so we have happily remove this now.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
OpenAPI doesn't appear to support versioning natively, suggesting
instead that separate documents are kept. Rather than doing this
manually, let's use a templating tool - Jinja2, in this case - to
generate these document for us from a single master document.
Note that while we can now auto-generate these whenever we need them
(and we tend to avoid storing auto-generated assets in VCS), these
change so rarely that it's easier to just store them. This also means we
can reference the schemas themselves online. We do this in a following
change.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
| |
This is the final resource to document and also the most complicated, on
account of the polymorphism of the responses. However, with this done,
our first pass at an OpenAPI 3.0 schema is completed.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
| |
Our first nested resource. Nothing too weird here though, save for the
raising of a HTTP 404 on a list resource (due to a missing patch).
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
| |
The big one (TM). Nothing too odd here though.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
| |
Again, we're adding embedded serializers before the main resource but
that will come.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
|
| |
This one's a little unusual too, in that we provide the embedded
serializer for resources we haven't defined the end resource for. That's
necessary in general, due to recursive references in the API
(series-patch, patch-series etc.) so might as well embrace it early.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
| |
This one's pretty straightforward.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
| |
This introduces our first use of embedded serializers, which are
separate models from the main ones. Other than that, this is pretty
standard.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
| |
This introduces our first use of parameters, both in the path and the
query. The latter are extracted out as they'll be used by later changes.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the REST API was first added, we attempted to document it using
OpenAPI 2.0 (formerly Swagger). This was mostly never completed because
(a) it was really tedious and (b) no one was that bothered. However, as
we expand the range of clients for the REST API, having a well
documented API becomes more and more of an asset.
Start doing this by adding a brand new schema, this time using OpenAPI.
This will entirely replace the older schema and, as such, is namespaced
separately. We start by documenting '/' (i.e. the index) page and will
add additional resources as we go.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was raising an attribute error when switching tests to use JSON
bodies instead of form-data.
AttributeError: 'dict' object has no attribute '_mutable'
The easy fix is to check if it's a dictionary and avoid the mutability
check if so.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
| |
The object is not serializable.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
|
| |
I'm not actually sure why this wasn't raising an error. Perhaps it's
because null validation for char fields happens in forms rather than at
the database level. In any case, this won't happen normally since we
only allow creation via the admin API so simply start setting this.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
| |
This wasn't used anywhere and can therefore be removed.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
| |
This was preventing the v1.1 fields from getting dropped as intended.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #237
|
|
|
|
|
|
|
|
|
|
| |
This was introduced in the recent "convert series from N:M to 1:N"
series. We take the opportunity to make the 'create_patch' and
'create_cover' utility methods a little smarter, in that series will
automatically be created for the patch/cover letter unless told not to.
This requires some related changes to other modules.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
| |
I'm not sure how I ever intended this to work and there were no tests
verifying things. Fix it now and add tests to prevent it regressing.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: 76505e91 ("models: Convert Series-Patch relationship to 1:N")
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
| |
This highlights an issue that will be resolved in a future change.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
|
| |
Add the decorator to the 'test_bundle' test class. This involves
splitting up the test cases so that each test case we care about makes
only a single request. We also add a missing test to ensure private
bundles cannot be shown by anyone but the owner.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
|
|
|
|
| |
We want to start including sample API requests and responses in our
documentation. Given that these may get out of date over time, we
should really generate these things dynamically. Create a decorator that
will allow us to do just that.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #225
|
|
|
|
|
| |
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #226
|