-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Slowly migrate to range over func #313
Comments
The ordered maps have a custom API, it's not ideal, but it means that we can swap out the underlying implementation underneath. I don't think this is bad at all personally: for schemaPairs := model.Model.Components.Schemas.First(); schemaPairs != nil; schemaPairs = schemaPairs.Next() {
// get the name of the schema
schemaName := schemaPairs.Key()
// get the schema object from the map
schemaValue := schemaPairs.Value()
// build the schema
schema := schemaValue.Schema()
// if the schema has properties, print the number of properties
if schema != nil && schema.Properties != nil {
fmt.Printf("Schema '%s' has %d properties\n", schemaName, schema.Properties.Len())
}
} However, if someone is open to trying to implement this, I think it would be great. |
It is not bad! And the implementation is spot on! That is why I love your tools; I was considering that maybe it is a good alternative for the future that better integrates with libraries (e.g., templates). |
So, I gave it a quick spin today! It works like a charm.
|
Nice! this looks great. What is this though? |
Ah I iterate over the elements and I check if they need to be excluded for my purpose (e.g. |
This has been addressed in #319 Courtesy of @TristanSpeakEasy |
Available in |
I have been struggling to find a good and clean solution for the introduced ordered map structs. Maybe consider and support the range-over-func experiment? It would remove the burden of having to re-create iterators for iterating over elements that are not natively supported by GO libraries 😄
I know it is still experimental, but I hardly find any reasons that this will not become stable in the long term.
The text was updated successfully, but these errors were encountered: