MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / field_schema

Method field_schema

ra-rpc/src/openapi.rs:804–829  ·  view source on GitHub ↗
(&mut self, field: &FieldDescriptorProto)

Source from the content-addressed store, hash-verified

802 }
803
804 fn field_schema(&mut self, field: &FieldDescriptorProto) -> Result<Value> {
805 if matches!(field_type(field), FieldType::Message)
806 && matches!(field_label(field), FieldLabel::Repeated)
807 {
808 if let Some(type_name) = &field.type_name {
809 let normalized = normalize_type_name(type_name);
810 if let Some(message) = self.registry.message(&normalized) {
811 if message.is_map_entry {
812 return self.map_field_schema(message);
813 }
814 }
815 }
816 }
817
818 let schema = match field_label(field) {
819 FieldLabel::Repeated => {
820 let inner = self.scalar_schema(field)?;
821 json!({
822 "type": "array",
823 "items": inner
824 })
825 }
826 _ => self.scalar_schema(field)?,
827 };
828 Ok(schema)
829 }
830
831 fn scalar_schema(&mut self, field: &FieldDescriptorProto) -> Result<Value> {
832 Ok(match field_type(field) {

Callers 1

Calls 5

normalize_type_nameFunction · 0.85
field_labelFunction · 0.85
messageMethod · 0.80
map_field_schemaMethod · 0.80
scalar_schemaMethod · 0.80

Tested by

no test coverage detected