swagger-api / swagger-api/swagger-core

XML: No way to have an object with both attribute and element value

Open
#4,403 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog
Dominant language
Java
Stars
7.5k
Forks
2.3k
Avg merge
18h 1m
Merged PRs (30d)
10

Description

XML: No way to have an object with both attribute and element value
e.g.
Some text

This is a revival of this issue from OpenAPI years ago:
https://github.com/OAI/OpenAPI-Specification/issues/630

I can define a object that has attributes, and some that have element values but not both.
Simple solution would be:

AttributeObject:
  type: object
  properties:
    name:
      type: string
      example: 'eventName'
      xml:
        attribute: true
    data:
      type: string
      example: 'myvalue'
      xml:
        elementValue: true
  xml:
    name: 'attribute'

Something like this should produce:
myvalue

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the XML example and the revived OpenAPI issue 630 to understand the requested attribute-plus-element-value behavior. No repository file or test is named; done means defining and supporting an object that serializes as myvalue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.