Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ensure schema object fields declare if they are nullable #55

Closed
paulsturgess opened this issue Jan 23, 2024 · 1 comment · Fixed by #56, #60 or #61
Closed

Ensure schema object fields declare if they are nullable #55

paulsturgess opened this issue Jan 23, 2024 · 1 comment · Fixed by #56, #60 or #61
Assignees

Comments

@paulsturgess
Copy link
Contributor

paulsturgess commented Jan 23, 2024

In Apia we can declare nullable fields like this:

class DiskTemplate < Apia::Object
  field :description, :string, null: true
  field :latest_version, Objects::DiskTemplateVersion, null: true
end

We need to ensure these declared as nullable in the spec.

@paulsturgess paulsturgess self-assigned this Jan 23, 2024
paulsturgess added a commit that referenced this issue Jan 23, 2024
In Apia we can declare nullable fields like this:

class DiskTemplate < Apia::Object
  field :description, :string, null: true
  field :latest_version, Objects::DiskTemplateVersion, null: true
end

These are now declared as nullable in the spec.

closes: #55
paulsturgess added a commit that referenced this issue Jan 24, 2024
In Apia we can declare nullable fields like this:

```
class DiskTemplate < Apia::Object
  field :description, :string, null: true
  field :latest_version, Objects::DiskTemplateVersion, null: true
end
```

These are now declared as nullable in the spec.

closes: #55
paulsturgess added a commit that referenced this issue Feb 5, 2024
@paulsturgess paulsturgess reopened this Feb 5, 2024
@paulsturgess
Copy link
Contributor Author

re-opening this as it's not quite fixed, but this PR should hopefully resolve it: #60

paulsturgess added a commit that referenced this issue Feb 6, 2024
paulsturgess added a commit that referenced this issue Feb 6, 2024
paulsturgess added a commit that referenced this issue Feb 6, 2024
paulsturgess added a commit that referenced this issue Feb 8, 2024
Follow on from #56

There were some places we didn't correctly set nullable for refs (sibling attrs are not allowed for refs).

We can set sibling attrs on refs, if we wrap them in `allOf`. This PR moves that fix into the central helper that generates most refs and we can enable it by specifying `sibling_props: true`.

It also fixes an issue where an apia endpoint declares the same error response (error code and http status) more than once. this can happen if say an ArgumentLookup declares an error response and then the endpoint itself does too.

the schema will no longer include endpoints in groups marked with `no_schema`.
Katapult has some of these for legacy endpoints. And these were also problematic as they used the same names
for a lot of api objects which were causing clashes.

the generator can also now handle when `include: true` (instead of a string). this is not the correct way to use the option, but Katapult uses it by accident presumably.

partial objects are now only generated when absolutely necessary. previously all child objects of a parent partial object were considered partial and this generated a unique entry in the schema. now we only generate partial child objects when absolutely necessary.

closes: #55
# for free to join this conversation on GitHub. Already have an account? # to comment