Skip to content

Response format specification: f parameter and content negotiation #12

Closed
@jonherrmann

Description

@jonherrmann

The current draft allows a client to pass the f-response format parameter and to use the Accept Header mechanism at the same time.

For discussion:

  • Since passing different response formats is possible, I would expect an error message in that case. I'm afraid that otherwise, errors are harder to trace.
  • Wouldn't the user assume that if he specifies the f-parameter, only the desired format is returned?

One possibility that would allow both mechanisms would be the use of format suffixes, like .json / .hmtl / .xml :

/buildings/{fid}:
    get:
      summary: retrieve a feature
      operationId: getFeature
      tags:
        - Features
      parameters:
        // f parameter dropped
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: A feature.
          content:
            application/geo+json:
              schema:
                $ref: '#/components/schemas/buildingGeoJSON'
            application/gml+xml;version=3.2:
              schema:
                $ref: '#/components/schemas/buildingGML'
            text/html:
              schema:
                type: string
        default:
          description: An error occured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/exception'
            application/xml:
              schema:
                $ref: '#/components/schemas/exception'
            text/html:
              schema:
                type: string

/buildings/{fid}.json:
    get:
      summary: retrieve a feature 
      operationId: getFeatureJson
      tags:
        - Features
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: A feature.
          content:
            application/geo+json:
              schema:
                $ref: '#/components/schemas/buildingGeoJSON'
        default:
          description: An error occured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/exception'

/buildings/{fid}.xml
...
/buildings/{fid}.html
...

A generic client could only use the /buildings/{fid} path and use content negotiation mechanism.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions