You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default (implicit/empty) module name should not cause machine filename to be '__' and human filename '_'.
Likewise the customSuperentity shouldn't start with a '.' in same scenario.
Actual Behavior
In the case of the default module: Current Product Module under Xcode "Class" options,
the managedObjectClassName has a leading '.' which is currently escaped to ''. In in the case of a leading '.', we should isolate it before conversion to '' because if the module name is missing.
This is a simple check and I will raise a PR.
Additionally the customSuperentity is prefixing the super class with a '.', again we can sanitise this just like we do for sanitizedManagedObjectClassName.
Further details:
Here are the options for module in the core data editor.
This is what the default template with current release version of mogenerator produce
➜ freemote-app git:(master) ✗ mogenerator --version
mogenerator 1.32. By Jonathan 'Wolf' Rentzsch + friends.
➜ freemote-app git:(master) ✗ ls -lh /Users/mitchellcurrie/Projects/freemote-app/Freemote/Shared/Persistence/Models-Autogen
total 80
-rw-r--r--@ 1 mitchellcurrie staff 98B 19 Mar 10:03 _Gateway.swift
-rw-r--r--@ 1 mitchellcurrie staff 146B 19 Mar 10:03 _HomeAssistantConnection.swift
-rw-r--r--@ 1 mitchellcurrie staff 95B 19 Mar 10:03 _KeyMap.swift
-rw-r--r--@ 1 mitchellcurrie staff 104B 19 Mar 10:03 _MappedKey.swift
-rw-r--r--@ 1 mitchellcurrie staff 113B 19 Mar 10:03 _TargetDevice.swift
-rw-r--r--@ 1 mitchellcurrie staff 2.2K 19 Mar 10:03 __Gateway.swift
-rw-r--r--@ 1 mitchellcurrie staff 1.5K 19 Mar 10:03 __HomeAssistantConnection.swift
-rw-r--r--@ 1 mitchellcurrie staff 3.7K 19 Mar 10:03 __KeyMap.swift
-rw-r--r--@ 1 mitchellcurrie staff 1.7K 19 Mar 10:03 __MappedKey.swift
-rw-r--r--@ 1 mitchellcurrie staff 1.7K 19 Mar 10:03 __TargetDevice.swift
Here is the contents of __HomeAssistantConnection.swift (machine file)
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
// Make changes to HomeAssistantConnection.swift instead.
import Foundation
import CoreData
publicenumHomeAssistantConnectionAttributes:String{case entityID ="entityID"case host ="host"case token ="token"}openclass_HomeAssistantConnection:.Gateway {
// MARK: - Class methods
overrideopenclassfunc entityName ()->String{return"HomeAssistantConnection"}overrideopenclassfunc entity(managedObjectContext:NSManagedObjectContext)->NSEntityDescription?{returnNSEntityDescription.entity(forEntityName:self.entityName(), in: managedObjectContext)}@nonobjcopenclassfunc fetchRequest()->NSFetchRequest<HomeAssistantConnection>{returnNSFetchRequest(entityName:self.entityName())}
// MARK: - Life cycle methods
publicoverrideinit(entity:NSEntityDescription, insertInto context:NSManagedObjectContext?){
super.init(entity: entity, insertInto: context)}publicconvenienceinit?(managedObjectContext:NSManagedObjectContext){
guard let entity = _HomeAssistantConnection.entity(managedObjectContext: managedObjectContext)else{returnnil}self.init(entity: entity, insertInto: managedObjectContext)}
// MARK: - Properties
@NSManagedopenvarentityID:String!@NSManagedopenvarhost:URL?@NSManagedopenvartoken:String?
// MARK: - Relationships
}
Notice the .Gateway as the super class of _HomeAssistantConnection (presumably because the module is inferred default, but it KNOWS it has a module). The PR I open will allow for a sanitised version of the name of the super class (but still maintain the existing one so as to not break things that work already).
Tagging @rentzsch
PS.
Fully specifying the module name results in both the files and classes being fully qualified which generally breaks things even worse.
Edit: It's also necessary (my case here) to use the current module instead of global because it seems to break some things in SwiftUI if we don't: See other post here
The text was updated successfully, but these errors were encountered:
Expected Behavior
Default (implicit/empty) module name should not cause machine filename to be '__' and human filename '_'.
Likewise the
customSuperentity
shouldn't start with a '.' in same scenario.Actual Behavior
In the case of the default module:
Current Product Module
under Xcode "Class" options,the
managedObjectClassName
has a leading '.' which is currently escaped to ''. In in the case of a leading '.', we should isolate it before conversion to '' because if the module name is missing.This is a simple check and I will raise a PR.
Additionally the
customSuperentity
is prefixing the super class with a '.', again we can sanitise this just like we do forsanitizedManagedObjectClassName
.Further details:
Here are the options for module in the core data editor.
This is what the default template with current release version of mogenerator produce
Here is the contents of
__HomeAssistantConnection.swift
(machine file)Notice the
.Gateway
as the super class of _HomeAssistantConnection (presumably because the module is inferred default, but it KNOWS it has a module). The PR I open will allow for a sanitised version of the name of the super class (but still maintain the existing one so as to not break things that work already).Tagging @rentzsch
PS.
Fully specifying the module name results in both the files and classes being fully qualified which generally breaks things even worse.
Edit: It's also necessary (my case here) to use the current module instead of global because it seems to break some things in SwiftUI if we don't:
See other post here
The text was updated successfully, but these errors were encountered: