marshmallow-code / marshmallow-code/apispec

Support nested schema inside object properties

Open
#379 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
1.2k
Forks
202
Avg merge
3h 38m
Merged PRs (30d)
3

Description

Hi. Maybe I missed, I'm trying to nest a schema to object type `properties`, but I couldn't found the way to solve this situation.

``` yaml
responses:
200:
content:
application/json:
schema:
type: object
properties:
addressInfo:
$ref: "#/components/schemas/AddressInfo"
description: Address info.
```

First I wrote below, but it doesn't work.

``` yaml
schema:
type: object
properties:
addressInfo:
$ref: AddressInfo
description: Address info.
```

This is one of options, but it can't declare `description`

``` yaml
schema:
type: object
properties:
addressInfo: AddressInfo
# description?
```

manual binding is not working because **AddressInfo** is not in **#/components/schema**

``` yaml
schema:
type: object
properties:
addressInfo:
$ref: "#/components/schemas/AddressInfo" # not defined.
description: Address info.
```

Is there a proper solution for this? 🙏 Thanks.

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

Start by tracing how the YAML response schema, object properties, and #/components/schemas references are represented and resolved. Check whether the current OpenAPI generation path supports a referenced nested schema with a property description; done means producing valid output for the AddressInfo example while preserving the nested reference and description, with coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.