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

Swagger form on home page doesn't let me create annotations with blank from_version #456

Closed
jsnshrmn opened this issue Dec 5, 2018 · 3 comments
Labels

Comments

@jsnshrmn
Copy link
Contributor

jsnshrmn commented Dec 5, 2018

I'm not sure if this is a swagger bug, the documentation, or the api itself, but I wanted to make note of it.
I suspect that swagger may be putting some literal strings in place of what should be null/empty values.

Expected Behavior

I'd expect to be able to leave optional fields empty in the swagger forms.

Current Behavior

If I leave from_version empty in the swagger form, I get 4xx responses back. Note that this field has the following legend

ID of the “before” Version. If omitted, it will be treated as the version immediately prior to to_version.
and isn't marked as required.

Steps to Reproduce (for bugs)

leaving from version blank, leads to a request like this:

curl -X POST "http://192.168.0.96:30000/api/v0/pages/69fe505d-cc39-4c16-a8a5-1abb2ae05974/changes/undefined..7cf48096-2237-454b-b46e-628019c10451/annotations" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{  \"int\": 100,}"

or

curl -X POST "http://192.168.0.96:30000/api/v0/pages/69fe505d-cc39-4c16-a8a5-1abb2ae05974/changes/{from_version}..7cf48096-2237-454b-b46e-628019c10451/annotations" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{  \"int\": 100,}"

and gets me varying 4xx responses

filling it in shows a request like this:

curl -X POST "http://192.168.0.96:30000/api/v0/pages/69fe505d-cc39-4c16-a8a5-1abb2ae05974/changes/b742ecdc-768e-4286-9d34-30d4bebdb848..7cf48096-2237-454b-b46e-628019c10451/annotations" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{  \"int\": 100}"

and succeeds

{
  "links": {
    "version": "http://192.168.0.96:30000/api/v0/pages/69fe505d-cc39-4c16-a8a5-1abb2ae05974/versions/7cf48096-2237-454b-b46e-628019c10451",
    "from_version": "http://192.168.0.96:30000/api/v0/pages/69fe505d-cc39-4c16-a8a5-1abb2ae05974/versions/b742ecdc-768e-4286-9d34-30d4bebdb848"
  },
  "data": {
    "uuid": "a1fd41c8-4ff8-4038-bc2c-35d3b8e51dc2",
    "annotation": {
      "int": 100
    },
    "created_at": "2018-12-05T21:54:56.050Z",
    "updated_at": "2018-12-05T21:54:56.050Z",
    "author": {
      "id": 1,
      "email": "seed-admin@example.com"
    },
    "from_version": "b742ecdc-768e-4286-9d34-30d4bebdb848",
    "to_version": "7cf48096-2237-454b-b46e-628019c10451"
  }
}

Context

I was using swagger to try to validate a bug fix just using the tooling that was already here.

Your Environment

@jsnshrmn jsnshrmn changed the title Swagger forms on home page leaves stuff in place of empty optional fields Swagger form on home page doesn't let me create annotations with blank from_version Dec 5, 2018
@Mr0grog
Copy link
Member

Mr0grog commented Dec 5, 2018

Yeah, this is partially a Swagger bug and partially the fact that having {thing}..{other_thing} in the path is invalid (at least in Swagger v2, and we haven't updated to v3, a.k.a OpenAPI).

Some folks have suggested that we change that to {change_id} and then set out in the description that {change_id} = '{from_id}..{to_id}'. ¯\_(ツ)_/¯

@Mr0grog
Copy link
Member

Mr0grog commented May 23, 2019

See also #65.

@stale
Copy link

stale bot commented Nov 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in seven days if no further activity occurs. If it should not be closed, please comment! Thank you for your contributions.

@stale stale bot added the stale label Nov 20, 2019
@stale stale bot closed this as completed Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants