Skip to content

readonly properties - #84

Merged
jryannel merged 2 commits into
mainfrom
jr-readonly-properties
Jun 20, 2023
Merged

readonly properties#84
jryannel merged 2 commits into
mainfrom
jr-readonly-properties

Conversation

@jryannel

Copy link
Copy Markdown
Contributor

Readonly properties allow API writers to designate properties as fields to be readonly.

In the YAML document you would add:

properties:
  - name: prop01
    type: int
    readonly: true

In the IDL you would use

interface Demo {
  readonly prop0: int

In the template you can check the type field:

{{ range .Properties }}
{{ if .IsReadOnly }}
// write readonly code
{{ end }}
{{ end }}

The same applies also to struct fields. But in general we see properties much more useful to be readonly then struct fields.

jryannel added 2 commits June 18, 2023 14:21
To ensure equality with YAML where the schema support readonly for struct fields, here we add readonly to struct fields for the IDL
@jryannel
jryannel requested a review from w4bremer June 18, 2023 14:33
@jryannel
jryannel merged commit 9530db7 into main Jun 20, 2023
@jryannel
jryannel deleted the jr-readonly-properties branch June 20, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants