tamasfe / aide

An API documentation library
Apache License 2.0
412 stars 68 forks source link

definitions_path fix #94

Closed evilbluebeaver closed 10 months ago

evilbluebeaver commented 11 months ago

Hi! I got my OpenApi generator broken after updating to 0.13.0. It generates a 'components/schemas' section for custom schemas but anchors to them are wrong. For example (I translated JSON to YAML for clarity):

paths:
  /healthz:
    get:
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/definitions/HealthCheckResult'

I don't know if my fix is a correct one but it did fix the issue for me.

Sagebati commented 11 months ago

I got this problem also, I'll test your fix

Wicpar commented 11 months ago

Please let me know, i didn't see a problem on master, but i do extract the schemas.

Sagebati commented 11 months ago

This indeed fixed my problem. Thank you !

evilbluebeaver commented 11 months ago

I guess the problem is this. s.definitions_path is only set to correct value when it's been called from 'extract_schemas' while extract flag is set. But at the same time this leads to setting 'needs_reset' flag in ApiRouter::merge_api. So SchemaGenerator will always be recreated with definitions_path set to default "#/definitions/"

Wicpar commented 10 months ago

Closing in favor of #96 which is a cleaner implementation. it changes the default to exctract which is generally better and can be disabled, both work.

Wicpar commented 10 months ago

fixed in 0.13.1