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

OpenAPISpecWriter does not support schema 'format' field. #392

Closed
1 task done
ArclightHub opened this issue Dec 15, 2021 · 0 comments
Closed
1 task done

OpenAPISpecWriter does not support schema 'format' field. #392

ArclightHub opened this issue Dec 15, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@ArclightHub
Copy link
Contributor

ArclightHub commented Dec 15, 2021

What happened?
When exporting API documentation using the OpenAPISpecWriter it does not allow us to add the optional 'format' String Formats field as described in the following swagger document:
https://swagger.io/docs/specification/data-models/data-types/

We could do something like this at the end of the generateFieldData function:

        } else {
            $optionalSchema=  [];
            if (isset($field->format)) {
                $optionalSchema['format'] = $field->format;
            }
            return array_merge([
                'type' => $this->normalizeTypeName($field->type),
                'description' => $field->description ?: '',
                'example' => $field->example,
            ], $optionalSchema);
        }

instead of...

        } else {
            return [
                'type' => $this->normalizeTypeName($field->type),
                'description' => $field->description ?: '',
                'example' => $field->example,
            ];
        }

Additional info:

We would also need to update the Parameters class to add a public $format variable.

I have made a PR here:
#394

@ArclightHub ArclightHub added the bug Something isn't working label Dec 15, 2021
@shalvah shalvah closed this as completed Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants