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

Documentation for Consuming generated code #15

Merged
merged 11 commits into from Jan 8, 2020

Conversation

truizlop
Copy link
Member

@truizlop truizlop commented Jan 3, 2020

This PR includes documentation for the following pages:

  • Running a network request
  • Customizing the configuration
  • Testing your network calls
  • Limitations

@truizlop truizlop added the documentation Improvements or additions to documentation label Jan 3, 2020
In some cases we may need to add headers to our requests. They can be added to a base configuration. Note that the original configuration will not be mutated, but a copy will be created with the new appended headers. We can use the following methods:
*/
let configWithHeaders1 = baseConfig.appending(headers: ["Accept": "application/json"])
let configWithHeaders2 = baseConfig.appendingHeader(value: "application/json", forKey: "Accept")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let configWithHeaders2 = baseConfig.appendingHeader(value: "application/json", forKey: "Accept")
let configWithHeaders2 = baseConfig.appendingHeader(value: "application/json", forKey: "Accept")
let configWithHeaders3 = baseConfig.appending(contentType: .json)


## Inline data types

In order to have a proper generation, you need to define data models in the `components` section in OpenAPI, or in the `definitions` section in Swagger. Defining your data models inline can result in generated code that is not properly named and therefore difficult to use.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nested models: inline nested models are not supported - you need to define the nested model as a ref to components or definitions section.


Nevertheless, Bow OpenAPI has some other limitations.

## Inline data types
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add information about encoding for body parameters - it is always being done with JSON encoder.

@truizlop truizlop merged commit 24e2827 into tomas/generation-docs Jan 8, 2020
@truizlop truizlop deleted the tomas/consuming-generated-code branch January 8, 2020 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants