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

Getting resource#one does not work, no errors. #617

Open
danielbatch opened this issue Jul 10, 2022 · 6 comments
Open

Getting resource#one does not work, no errors. #617

danielbatch opened this issue Jul 10, 2022 · 6 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@danielbatch
Copy link

danielbatch commented Jul 10, 2022

Describe the bug
Though tried to get one resource from list page, it did not work and redirected to list page.
It threw no errors.


To Reproducene
Steps to reproduce the behavior:

  1. Go to resource#list page. And showed resources as I expected.
  2. Click on resource#show by path parameter and submit.

resource_one

  1. The api returns data as I expected. I confirmed this response in developer tool and server log.
{
  id: 1,
  price: 100,
  url: "https://example.com"
}
  1. Did not move to resource#one page, instead redirected to resource#list page.

Expected behavior
After clicking submit button on modal of resource#list to find resource, move to resource#one page, not redirected to list page.


Additional context

  • Mac OS Big Sur 11.5.2
  • google chrome

My resource definition is this.

    Resource:
      type: object
      properties:
        id:
          description: ID
          type: string
        price: 
          description: 価格
          type: number
        url:
          description: URL
          type: string
          format: uri
      required:
        - id
        - price
        - url

Thanks,

@danielbatch danielbatch added the bug Indicates an unexpected problem or unintended behavior label Jul 10, 2022
@cathcheeno
Copy link
Contributor

cathcheeno commented Jul 11, 2022

@danielbatch
Sorry, but it's hard for me to understand the situation with the information given.
Could you show me a valid full OAS document so I can grab the whole picture of what you are trying to achieve.

@danielbatch
Copy link
Author

@cathcheeno
Hi, this is the oas doc. I want to get one article, and the API returns the response as above, but does not move to article#one page when I query to get one(reproduce step2)

openapi: 3.0.0
info:
  description: viron sample
  title: viron-sample
  version: 0.0.1
  x-number:
    responseKey: value
  x-table:
    responseListKey: list
  x-pages:
  - id: articles
    title: list articles
    description: article operations
    group: articles
    contents:
    - title: article list
      type: table
      operationId: getArticles
servers:
- url: /
paths:
  /articles:
    get:
      operationId: getArticles
      parameters:
      - description: Size of list
        in: query
        name: size
        required: false
        schema:
          type: integer
      - description: Page number of list
        in: query
        name: page
        required: false
        schema:
          type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ArticleList'
          description: ok
      summary: list articles
      tags:
      - article
  /articles/{id}:
    get:
      operationId: getArticle
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Article'
          description: ok
      summary: get one article
      tags:
      - article
components:
  schemas:
    ArticleList:
      example:
        list:
        - id: id
          price: price
          url: https://openapi-generator.tech
        - id: id
          price: price
          body: body
          url: https://openapi-generator.tech
      properties:
        list:
          items:
            $ref: '#/components/schemas/Article'
          type: array
      required:
      - list
      type: object
    Article:
      example:
        id: id
        price: price
        url: https://openapi-generator.tech
      properties:
        id:
          description: ID
          type: string
        price:
          description: price
          type: number
        url:
          description: URL
          format: uri
          type: string
      required:
      - id
      - price
      - url
      type: object

@cathcheeno
Copy link
Contributor

@danielbatch
It seems you have only one page, one named articles under info['x-pages'] object, which means there is no page to display resource#one or to navigate to.
Plus, your expected behavior above is not feasible as Viron doesn't have the function(or intention to implement it in the future) to navigate pages after triggering operations.

Please let us know

  • what you plan to display on resource#one page
  • why you want to do so (since the data of resource#one is already on the table content of resource#list page)
    so that the Viron team can discuss adding a new content type for data of type object.

thanks.

@danielbatch
Copy link
Author

@cathcheeno
Thanks, understood.

This is my intent,

what you plan to display on resource#one page

All data of one resource with many columns.

why you want to do so (since the data of resource#one is already on the table content of resource#list page)
so that the Viron team can discuss adding a new content type for data of type object.

If the resource has many columns(id, price, url, author, created_at, deleted_at, edited_at...etc), I thought its not convenient to see all data on list page because I have to scroll sideways a lot to find data.

And is it possible to copy uri-format data when tap the column on list page?

For example, the article resource has url column. And the oas definition is this.

 url:
    description: URL
    format: uri
    type: string

I want to copy or open url when tap this column if cannot move to article#one page.
sample-viron

@cathcheeno
Copy link
Contributor

@danielbatch
I've created issues for the new content type and table cell interaction.

@danielbatch
Copy link
Author

@cathcheeno
Thank you. Hope the features will be integrated after discussing with viron developer team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants